Why does D rely on a GC?

ketmar via Digitalmars-d digitalmars-d at puremagic.com
Tue Aug 19 00:25:51 PDT 2014


On Tue, 19 Aug 2014 07:14:17 +0000
ponce via Digitalmars-d <digitalmars-d at puremagic.com> wrote:

> I work in such an environment and I tend to agree with you.
just replace GC with stub doing only allocs (or use GC.disable) and
manage resource freeing manually (or with corresponding templated
struct wrappers).

> In D having deterministic resource release is harder because 
> scoped ownership is less polished than in C++.
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.
-------------- 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/20140819/14562be3/attachment.sig>


More information about the Digitalmars-d mailing list