Should compilers take advantage (abuse) of the new UDA syntax that has been accepted?

jerro a at a.com
Tue Dec 18 11:06:16 PST 2012


> On *that* particular attribute, I will accept that there isn't 
> much you could do differently from a theoretical standardised 
> version. The problem is, as soon as you add one compiler 
> specific attribute, it will be used as a precedence for adding 
> others.

You could just name compiler specific attributes something like 
GDC_noreturn, just like http://dlang.org/pragma.html currently 
recommends for pragmas. You could also define them in compiler 
specific modules as has already been discussed in this thread, 
but then code that used them without full names (including the 
module name) would break if an attribute with the same name was 
added to the language.

> pragma exists for the purpose of compiler-specific extensions. 
> Can we just keep using that, and if an attribute comes up that 
> could be truly useful for all compiler then it can be added to 
> the spec.

But you can't do as much with pragmas as you can with attributes. 
For example, you can alias attributes, and I hope you will also 
be able to use tuples of attributes - see my example in this 
thread:

http://forum.dlang.org/thread/uyvdqwslsphshxoioqnw@forum.dlang.org


More information about the Digitalmars-d mailing list