User Defined Attributes

Simen Kjaeraas simen.kjaras at gmail.com
Wed Nov 7 01:06:23 PST 2012


On 2012-39-06 20:11, Jacob Carlborg <doob at me.com> wrote:

> On 2012-11-06 19:24, David Nadlinger wrote:
>
>> You are right, UDAs must definitely leverage D's module system for
>> encapsulation/disambiguation. Use of string literals (which are
>> intrinsically »global«) as annotations needs to be explicitly  
>> discouraged.
>
> Then why allow it in the first place?
>

Because string literals are just a special case of literals?

i.e. if this works:

struct MyString {
     string s;
     alias s this;
}

@MyString("Foo") int n;

then why should this not work:

@"Foo" int n;

I agree it's useless, but it seems a very arbitrary restriction, too.

-- 
Simen


More information about the Digitalmars-d-announce mailing list