Mitigating the attribute proliferation - attribute inference for functions

Jack Stouffer via Digitalmars-d digitalmars-d at puremagic.com
Fri Jul 17 12:14:19 PDT 2015


On Friday, 17 July 2015 at 18:11:46 UTC, Martin Nowak wrote:
> Because I want to overhaul smart pointers/refs (Unique, RC).
> A seemingly trivial task, should take a few hours, but I 
> already spent days to hack around all the attribute issues.

I think the axiom "make it hard for engineers so it's easy for 
users" applies here.

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. 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. Saying "just use -profile=gc" would be like always 
reaching for gdb when printf will solve your problem faster.

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.


More information about the Digitalmars-d mailing list