DIP60: @nogc attribute

Adam D. Ruppe via Digitalmars-d digitalmars-d at puremagic.com
Wed Apr 16 10:52:07 PDT 2014


On Wednesday, 16 April 2014 at 17:39:32 UTC, Walter Bright wrote:
> Not practical. malloc() is only one way of allocating memory - 
> user defined custom allocators are commonplace.

What I want is a __trait that scans for all call expressions in a 
particular function and returns all those functions.

Then, we can check them for UDAs using the regular way and start 
to implement library defined things like @safe, @nogc, etc. (safe 
and gc are a bit different because they also are affected by 
built-in language features, not just functions, but the same idea 
of recursively scanning for an annotation in the function body).

Of course, this wouldn't always be perfect, separate compilation 
could be used to lie about or hide annotations in a function 
prototype, but meh I don't really care about that, the main use 
for me would eb static asserts right under the function 
definition anyway.


More information about the Digitalmars-d mailing list