Mitigating the attribute proliferation - attribute inference for functions
ponce via Digitalmars-d
digitalmars-d at puremagic.com
Fri Jul 17 09:57:47 PDT 2015
On Friday, 17 July 2015 at 16:40:56 UTC, Jonathan M Davis wrote:
> @nogc is mostly a PR thing IMHO. It has value in that it helps
> you find places where you accidentally used the GC (though if
> you really care, you can always use the profiler as you point
> out), and if @nogc is marked explicitly, it makes it easier to
> see which functions can be used in @nogc code, but ultimately,
> it really seems like it's there simply to appease the folks who
> don't want any GC usage at all.
I thought it was a PR thing, but because few things use malloc
implicitely and @nogc enforce no GC, I find it actually useful to
check if a function does zero allocations. Not the worst
attribute.
> Honestly, what we should do if we don't care about code
> breakage is make pure and @safe the default, since they really
> should be the rule rather than the exception. That would reduce
> the problem considerably. But the problem is that that breaks
> code, and without @safe whitelisting stuff instead of
> blacklisting it, it would probably make the breakage related to
> fixing @safe holes even worse. So, I very much doubt that we
> can do it at this point, much as that's really where we want to
> be.
Please no. Code is born ugly and then gets better and attributed.
For scripting and peace of mind, D gets every default right; it's
just that some attributes are not really worth it and should be
killed imho.
More information about the Digitalmars-d
mailing list