On Wednesday, October 09, 2013 01:04:39 Tourist wrote: > I thought about an alternative approach: > Instead of using a (yet another) annotation, how about > introducing a flag similar to -cov, which would output lines in > which the GC is used. > This information can be used by an IDE to highlight those lines. > Then you could quickly navigate through your performance-critical > loop and make sure it's clean of GC.
That sounds like a much less invasive approach no a @nogc attribute. We already arguably have too many attributes. We shouldn't be adding more unless we actually need to. And if we work towards making better use of output ranges in Phobos, it should become reasonably easy to determine which functions might allocate and which won't, so anyone writing code that wants to avoid the GC will know which functions they can call and which they can't. And your proposed flag would catch the cases that they miss. So, I'd say that this along with the --nogc flag seem like good ideas. - Jonathan M Davis