UDAs name convention

Daniel Kozak via Digitalmars-d digitalmars-d at puremagic.com
Tue Jan 27 15:02:32 PST 2015


When I read discusion about @nothrow @pure... I start thinking 
what will happen if  go that way.

If we make an agreement on @pure and so on we are ok now because 
pure is a keyword already. But if there will be that consensus 
all other attributes should have @ in name. For eg. we add 
@virtual or @forceinline. This could cause some code breakage if 
someone already use UDA with this name.

One way how to avoid it would be allow @pure @virtual and others 
only on right side so it would not clash with UDAs so this code 
will work:

struct virtual {}

class C
{
     @virtual void someFun() @virtual {}
}

But it does not look OK for me.

So I think it would be nice to have some name convention for 
UDAs, so one can be sure it will never be in conflict with 
compiler attributes.

So what do you think?


More information about the Digitalmars-d mailing list