DIP60: @nogc attribute

monarch_dodra via Digitalmars-d digitalmars-d at puremagic.com
Tue Apr 15 13:25:40 PDT 2014


On Tuesday, 15 April 2014 at 19:56:46 UTC, Walter Bright wrote:
> On 4/15/2014 12:49 PM, Tove wrote:
>> Yes, please all, even "harmless" calls. This way you are 
>> guaranteed that you can
>> include @nogc modules in projects which doesn't even link with 
>> a GC.
>
> Yup.

One issue we might encounter, is that when a function requires a 
local temporary buffer, then "@nogc" and "pure" will be mutually 
exclussive. Implementation can either use the GC, and be pure but 
not @nogc. Or it can use malloc, and no @nogc but impure.

I recently worked on a more generic version of your 
"ScopeBuffer", "ScopeAppender", which makes some concessions to 
be usable in a more generic fashion. It uses the GC, even though 
it retains complete ownership of the allocated data, if only just 
to be useable in pure code.

So, yeah. That might be a problem for those that want to do 
without the GC, but retain purity.


More information about the Digitalmars-d mailing list