Mitigating the attribute proliferation - attribute inference for functions

Martin Nowak via Digitalmars-d digitalmars-d at puremagic.com
Fri Jul 17 15:16:02 PDT 2015


On Friday, 17 July 2015 at 19:14:21 UTC, Jack Stouffer wrote:
> As others have said @safe, pure, nothrow, and @nogc, while they 
> could be improved somewhat, have value in that they provide 
> guarantees to the programmer (user) and API end users.

As I mentioned, @safe doesn't provide any guarantee and 
pure/nothrow provide nice guarantees, but ones that should be a 
matter of course depending on the API.

> One thing that no one has mentioned is that @nogc lets me know 
> which part of my program is using GC allocations without 
> reaching for a profiler.

Except that it hardly works, b/c noone made the effort to 
attribute all of druntime/phobos. We also have the -vgc switch 
btw.

> This however, makes the phobos maintainer (engineers) job 
> harder, and I respect that. But, as a casual D user, I think 
> attributes make D a better language.

One of our biggest issues is the lack of good contributions, so 
deciding to spend a significant overhead on attributes is a big 
deal, which I doubt will ever pay off.


More information about the Digitalmars-d mailing list