DIP60: @nogc attribute

Dicebot via Digitalmars-d digitalmars-d at puremagic.com
Fri Apr 25 08:12:54 PDT 2014


On Friday, 25 April 2014 at 14:01:07 UTC, Steven Schveighoffer 
wrote:
>> It is unacceptable to have code that fails with one compiler 
>> and works with the other despite the shared frontend version. 
>> Such "enhanced" @nogc attributes must be placed into 
>> compiler-specific attribute space and not as a core language 
>> feature.
>
> Like I said, this may be the ideologically correct position, 
> but please explain to the poor user that even though the 
> compiler does not invoke the GC in his function, it still 
> cannot be @nogc.
>
> I think in this case, @nogc is not a good name.

Which is the very reason why I was so insisting of defining exact 
set of cases when optimisation is to be guaranteed in spec 
(before releasing @nogc). Unfortunately, with no success.

> But what really is the difference between a function that is 
> marked as @nogc that compiles on compiler X but not compiler Y, 
> and some custom attribute that compiles on X but not Y?

There are no user-defined attributes that can possibly fail on 
only some compiler. And compiler-specific attributes are part of 
that compiler documentation and never part of language spec. This 
is the difference.


More information about the Digitalmars-d mailing list