UDAs - Restrict to User Defined Types?

deadalnix deadalnix at gmail.com
Sat Nov 10 07:39:53 PST 2012


Le 08/11/2012 19:55, simendsjo a écrit :
> On Thursday, 8 November 2012 at 17:20:39 UTC, Jacob Carlborg wrote:
>> On 2012-11-08 17:53, simendsjo wrote:
>>
>>> I guess it depends. I find it easier to see that it's an attribute,
>>> especially when you annotate it. But it's harder to grep for.
>>>
>>> Is foo an attribute or not?
>>> @serializable
>>> @xmlRoot
>>> @attribute
>>> @displayName("foo")
>>> struct foo {}
>>>
>>> Is foo an attribute or not?
>>> @serializable
>>> @xmlRoot
>>> @displayName("foo")
>>> struct @foo {}
>>>
>>
>> I don't know really. In that bottom example, the struct declartion
>> almost disappears among all the attributes.
>
> Yeah.. But at least you'll always know where to look.
>
> @[serializable, xmlRoot, attribute, displayName("foo")]
> struct foo {}
>
> @[serializable, xmlRoot, displayName("foo")]
> struct @foo {}
>
> but attribute could be required as the last type, and on a line of it's
> own, giving:
>
> @[serializable, xmlRoot, displayName("foo")]
> @attribute
> struct foo {}
>

More special case isn't a good idea. We already have way too much of them.


More information about the Digitalmars-d mailing list