GC for pure functions -- implementation ideas

Gor Gyolchanyan gor.f.gyolchanyan at gmail.com
Tue Nov 8 06:05:35 PST 2011


> __traits(gcallocates, someFunction)

This would be an AWESOME idea, because it would allow to specialize
functions based on the way, let's say, delegates behave and if they
don't use GC, the specialized function would also restrain from using
it making it follow the behavior pattern and making it much more
usable in performance-critical environments, while keeping it usable
in GC-aware environment too.


On Tue, Nov 8, 2011 at 5:53 PM, bearophile <bearophileHUGS at lycos.com> wrote:
> Robert Jacques:
>
>> I really like this general concept (It feels a lot like young/old
>> generational collecting, but without the overhead), both for non-leaky
>> pure functions and ctfe.
>
> As first step to implement Don's GC idea I think it will be useful a __traits(gcallocates, someFunction) that returns true at compile-time if someFunction performs allocations from the GC heap or if it calls functions where __traits(gcallocates, otherFunction) returns true.
>
> Bye,
> bearophile
>


More information about the Digitalmars-d mailing list