On Tuesday, 15 April 2014 at 17:01:38 UTC, Walter Bright wrote:
http://wiki.dlang.org/DIP60

Start on implementation:

https://github.com/D-Programming-Language/dmd/pull/3455


"GC allocations in a @nogc function will be disallowed, and that means calls to operator new"

I do not think new is exclusive to GC? It can be overridden. If new is overridden by classes and marked @nogc then it too should be allowed.

e.g., new, slices, array behavior, even all the GC methods themselves, are all not necessarily dependent on the GC if their behavior can be overridden not to use the GC.

Essentially all default GC dependent behavior should be marked @gc and all default non-GC dependent behavior should be marked @nogc. User defined behavior could be marked either way except @nogc behavior can't use @gc behavior.

After all, @nogc is just an attribute and means nothing except what is prescribed to it(you could mark all the GC's functions as @nogc and then use them in @nogc code if you want, which, of course, defeats the whole purpose).

I just hope that if implemented, it is not blindly done so that prevents one from accurately removing GC dependence(which is the whole point of having the attribute).





Reply via email to