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?
On Thursday, 11 September 2014 at 18:04:06 UTC, Andrey Lifanov
wrote:
Thank you all for replies!
I'm not saying that GC is evil. I just want to have different
options and more control, when this is required. If D offered
such choice, many good C++ programmers would have certainly
considered D as a perfect alternative to C++.
D states that there is no strict and dogmatic rules that it
follows about programming languages paradigms. And that it is
a general purpose language. So I think it would be nice to
have more options of how we can manage memory.
I will continue investigation and certainly inform you if it
ends with something useful.
Here are a few of the bazillion threads that have discussed the
topic:
http://forum.dlang.org/thread/[email protected]?page=1
http://forum.dlang.org/thread/[email protected]?page=1
http://forum.dlang.org/thread/[email protected]