On 24.06.2014 21:32, Jacob Carlborg wrote:
Since we got UDA's that use the @attribute syntax, the idea of appending
an @ symbol in front of an attribute to avoid name collisions doesn't
work anymore.
From a user point of view, the attributes starting with an @ symbol are
just as much keywords as those who don't.
Wouldn't an attribute like @nogc only be a keyword for attribute
symbols, while something like nothrow is a keyword for everything?
E.g. using @nogc means I can't define my own "nogc" UDA but I can have a
function or variable named nogc, while I can't have a function named
"nogc". Being a "attribute keyword" seems a much smaller restriction on
user code.
I sympathize with you, but I think that we're stuck at this point.
I we want to minimize name collisions it would be better to remove all
attributes and only have a single attribute, like this:
@attribute(nothrow, public, const) void foo ();
If what I wrote above is correct, why not declare existing
compiler-attributes "attribute keywords", and then allow a mix of them:
@(nothrow, public, const, "my_custom_attribute") void foo ();