-nogc

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Thu Apr 23 06:02:27 PDT 2009


dsimcha wrote:
> == Quote from Andrei Alexandrescu (SeeWebsiteForEmail at erdani.org)'s article
>> I've discussed something with Walter today and thought I'd share it here.
>> The possibility of using D without a garbage collector was always
>> looming and has been used to placate naysayers ("you can call malloc if
>> you want" etc.) but that opportunity has not been realized in a seamless
>> manner. As soon as you concatenate arrays, add to a hash, or create an
>> object, you will call into the GC.
>> So I'm thinking there should be a flag -nogc that enables a different
>> model of memory allocation. Here's the steps we need to take:
>> 1. Put array definitions in object.d. Have the compiler rewrite "T[]" ->
>> ".Array!(T)" and "[ a, b, c ]" -> ".Array!(typeof(a))(a, b, c)". I think
>> superdan suggested that when he wasn't busy cursing :o).
> 
> One of my concerns with this is what effect it would have on CTFE, templates, etc.
>  One of the nice things about truly builtin arrays and AAs is that they fully work
> at compile time.  I'd be for this idea only if we could guarantee that nothing
> with respect to arrays and AAs that works at compile time now would break if they
> were moved to object.

All compile-time stuff will remain unchanged. Only when it comes about 
generating code will the idea enter in action.

Andrei



More information about the Digitalmars-d mailing list