On Thursday, 11 September 2014 at 18:32:10 UTC, Daniel Alves
wrote:
You know, currently I spend most of my time programming in
ObjC, but I really love C, C++ and D.
Since the Clang Compiler, ObjC dropped the GC entirely. Yes,
that's right, no GC at all. And, in fact, it does support
concurrent programming and everything else. The magic behind it
is ARC - Automated Reference Counting
(http://clang.llvm.org/docs/AutomaticReferenceCounting.html):
the compiler analyzes your code, figures out object scopes and
sets the correct calls to retain/release/autorelease (for those
who are not familiar with ObjC, pointers are mostly reference
counted). So there is no need for a GC and all its
complications.
In addition to that, Rusty also has an approach like ObjC
called Region Pointers and objects' Lifetime
(http://doc.rust-lang.org/guide-pointers.html#boxes). The idea
is the same, but, depending on the type of the pointer, the
compiler may add a call for freeing or for decrementing a
pointer reference counter.
Finally, it looks like there is a language called Cyclone that
goes the same way (paper here:
http://www.cs.umd.edu/projects/cyclone/papers/cyclone-regions.pdf)
Since I read Andrei's book, D Programming Language, I've been
asking myself why D does not go this way...
Anyone knows about a good reason for that?
There have been some long threads about ARC, including this one
from a couple months ago:
http://forum.dlang.org/thread/[email protected]
Walter doesn't think ARC can be done efficiently.