Why does D rely on a GC?

ponce via Digitalmars-d digitalmars-d at puremagic.com
Tue Aug 19 03:24:07 PDT 2014


On Tuesday, 19 August 2014 at 07:26:07 UTC, ketmar via 
Digitalmars-d wrote:
> but why?! see 'scoped' to scope allocations. and, for example, 
> 'File',
> which is refcounted internally. plus 'scope()' finalizers.
>
> i'm pretty sure that scoped ownership in D at least on par with 
> C++, if
> not better and simplier either to write, to read and to use.
>
> of course, you'll loose such nice features as closures and 
> slices, but
> hey, C++ doesn't have them too! ok, C++11 has lambdas, and i 
> don't know
> if D lambdas can work without GC and don't leak.

I'm well aware of all that exist to do deterministic destruction.
There is no _composable_ way to do it apart from using structs 
exclusively and RefCounted!.
I can't find the previous thread about this but there was 
problems, eg. Unique should work with both classes and structs 
but does not.


More information about the Digitalmars-d mailing list