Actually this could be good idea, it is after all where
Objective-C (with ARC) and C++ on Windows (C++/CX) are
moving to.
But there can be some performance issues nonetheless. I
am no GC expert, but I think in most cases the overhead
imposed by increment/decrement operations looses against
most advanced GC in use today.
--
Paulo
Am 11.12.2011 16:14, schrieb Chad J:
On 12/11/2011 08:15 AM, maarten van damme wrote:
...
I was only trying it "for the fun of it", not to be used seriously. D
should always have it's GC support built-in and have some functions to
control it's behaviour (core.memory). But I think that D, beeing a
systems programming language, should also be able to be used without GC.
I don't mean phobos to be writtin without a GC in mind but druntime
should be compilable with something like a -nogc flag that make it
usable without GC.
There are a lot of users out there who think that a GC produces terribly
slow programs, big hangs while collecting,... (thank java for that.
Right now the java GC has been improved and it's extremely good but the
memory stays :p)
Letting them know that D can be run without GC can be a good point. If
they don't like it, they can turn it off.
I think one thing that could would be (optional) reference counting for
transitively atomic types. Of course, this is just another kind of
garbage collection, but it is /deterministic/ and parallelizes well, and
I bet this would open up a large amount of Phobos while the
stop-the-world collector is offline, and with little or no code change.
The big example in my mind is strings. Strings are straight-up atomic.
They can't have the reference cycles that would confuse a reference
counter. And if we allowed them to be reference-counted, then all of
the string functions using copy-on-write would now work with the
stop-the-world collector disabled.
It's something I've been thinking of mentioning for a while, but I
suspect there are higher priority things at the moment.