Why does D rely on a GC?

ketmar via Digitalmars-d digitalmars-d at puremagic.com
Tue Aug 19 16:40:37 PDT 2014


On Tue, 19 Aug 2014 07:13:45 -0700
Andrei Alexandrescu via Digitalmars-d <digitalmars-d at puremagic.com>
wrote:

> One issue with this is e.g. hashtables have no primitive for freeing 
> entries.
ah, so don't use built-in AAs. templated class/struct can replace 'em,
let with less beauty in declaration. i believe that something similar
can be done with arrays and strings, and with RC slices. and 2.066
moved some built-in properties to functions, which will help too.

but seems that *most* people are OK with GC, so such replacements
should not be defaults. and if somebody will port Leandro's CDGC, "stop
the world" problem can be avoided almost entirely.

but maybe there is some sense to shipping alternate "nogc/rc" runtime
with D. the main problem with that is that someone has to write and
support it. ;-)

>> i don't know if D lambdas can work without GC and don't leak.
> They don't use GC if scoped.
that's great. i'm very used to GNU C extension, which allows nested
functions and something like lambdas in C, and was very happy to find
that feature ofically blessed in D. i'm even more happy now when i know
for sure that they will not trigger allocations.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20140820/917febac/attachment.sig>


More information about the Digitalmars-d mailing list