accept @pure @nothrow @return attributes

via Digitalmars-d digitalmars-d at puremagic.com
Mon Jan 26 05:21:54 PST 2015


On Monday, 26 January 2015 at 11:39:23 UTC, Jonathan M Davis 
wrote:
> immutable, inout, and deprecated all don't have @. So, most 
> function
> attributes _don't_ have @ on them, and we just added @ to some 
> of them,
> making things even _less_ consistent. In fact, priore to this, 
> @safe,
> @trusted, @system, and @property were the _only_ function 
> attributes with @
> on them. So, if we really wanted to improve consistency IMHO, 
> we'd get rid
> of @ from everything that's built-in and leave it for 
> user-defined
> attributes, but that would break existing code too.

I agree  that you need to let "@" act as some kind of mnemonic 
and therefore assign meaning to it.

One meaning would be to only use "@" with attributes that do not 
affect computation, typing, overloading etc and use it only for 
safety-checks and optimization hints (like inlining).

Besides it would be easy to change the parser so that terms can 
be reused as symbols if the grammar stays sound. I think that is 
true for most function attributes anyway.


More information about the Digitalmars-d mailing list