DIP60: @nogc attribute

Walter Bright via Digitalmars-d digitalmars-d at puremagic.com
Sat Apr 19 11:41:40 PDT 2014


On 4/19/2014 11:05 AM, Dicebot wrote:
> I feel like the origin of the discussion has been completely lost here and we
> don't speak the same language right now. The very point I have made initially is
> that @nogc in a way it is defined in your DIP is too restrictive to be
> effectively used in Phobos.
>
> In lot of standard library functions you may actually need to allocate as part
> of algorithm, strict @nogc is not applicable there. However, it is still
> extremely useful that no _hidden_ allocations happen outside of weel-defined
> user API and this is something that less restrictive version of @nogc could help
> with.
>
> The fact that you propose me to use unit tests to verify same guarantees hints
> that I have completely failed to explain my proposal but I can't really rephrase
> it any better without some help from your side to identify the point of confusion.

The way I understood your idea, was that a template could be marked @nogc, and 
yet still allow template arguments that themselves may gc.

This can be accomplished by creating a unit test that passes non-allocating 
template parameters, and then verifying the instantiation is @nogc.



More information about the Digitalmars-d mailing list