Re: User Defined Attributes

2012-11-16 Thread Tove
On Thursday, 15 November 2012 at 22:04:27 UTC, David Nadlinger wrote: On Thursday, 15 November 2012 at 08:45:49 UTC, Tove wrote: I disagree, you can always fallback to using user defined types... but it _allows_ for native types also, i.e. more flexible. You are missing the point: In your

Re: User Defined Attributes

2012-11-16 Thread Walter Bright
On 11/15/2012 12:22 AM, Jacob Carlborg wrote: On 2012-11-14 22:13, Walter Bright wrote: I am having a REALLY hard time making my point here. struct MyString { string s; } Just because it is not a builtin type does not change anything. Sure you _can_ but it would be quite stupid. With

Re: User Defined Attributes

2012-11-16 Thread Tove
On Friday, 16 November 2012 at 10:41:44 UTC, Walter Bright wrote: The whole point of my example was no, you do not necessarily know the meaning of a user-defined type that is used as an attribute. Agree. Imagine we have 3 generic libs/modules... Optimized CTFE Polygon Primitive Lib, Math, Gfx

Re: User Defined Attributes

2012-11-16 Thread deadalnix
Le 14/11/2012 22:13, Walter Bright a écrit : On 11/14/2012 2:53 AM, Jacob Carlborg wrote: If std.mytypes.mystring is a variable of the type string then the fully qualified name is lost if it's used as an attribute. Something like this: I am having a REALLY hard time making my point here.

Re: User Defined Attributes

2012-11-16 Thread Walter Bright
On 11/14/2012 2:18 AM, Leandro Lucarella wrote: Can you provide one concrete case where it makes sense NOT to restrict UDAs to types One where its use is entirely inside the scope of a module, i.e. local use of it. There seems to be an assumption that UDAs are global, but I don't see a

Re: User Defined Attributes

2012-11-16 Thread David Nadlinger
On Friday, 16 November 2012 at 13:12:34 UTC, Tove wrote: On Friday, 16 November 2012 at 10:41:44 UTC, Walter Bright wrote: The whole point of my example was no, you do not necessarily know the meaning of a user-defined type that is used as an attribute. Agree. Imagine we have 3 generic

Re: User Defined Attributes

2012-11-16 Thread Jacob Carlborg
On 2012-11-16 11:41, Walter Bright wrote: Sure you _can_ but it would be quite stupid. With user defined types there is at least some context. With a plain string (or any built in type) it can come from any where and mean anything. The difference is, with a user defined type you know the