On heap segregation, GC optimization and @nogc relaxing

via Digitalmars-d digitalmars-d at puremagic.com
Wed Nov 12 04:57:57 PST 2014


On Wednesday, 12 November 2014 at 06:48:47 UTC, deadalnix wrote:
> On Wednesday, 12 November 2014 at 03:13:20 UTC, Rikki 
> Cattermole wrote:
>> [...]
>
> yes and no. The ideas is similar, but it is not doable at 
> library level if we want to get safety and the full benefit out 
> of it, as it would require for the compiler to introduce some 
> call to the runtime at strategic places and it does interact 
> with @nogc.

I'm not sure. A library implementation may be feasible. For 
invalidation, the objects can be returned to their init state. 
This is "safe", but maybe not ideal, as a compiler error might 
indeed be better. Even implicit conversion to shared & immutable 
will be possible with multiple alias this, though it's worth 
discussing whether an explicit conversion isn't preferable.

As for @nogc, I see it as a clutch that's needed while no "real" 
solution is available, and as a tool for aiding transition once 
we have one.

That said, some compiler support will definitely be necessary.


More information about the Digitalmars-d mailing list