Custom attributes (again)

Steven Schveighoffer schveiguy at yahoo.com
Thu Apr 5 11:21:46 PDT 2012


On Thu, 05 Apr 2012 14:05:49 -0400, Andrei Alexandrescu  
<SeeWebsiteForEmail at erdani.org> wrote:

> On 4/5/12 12:44 PM, deadalnix wrote:
>> Le 05/04/2012 19:35, Walter Bright a écrit :
>>> On 4/5/2012 5:00 AM, Manu wrote:
>>>> C# and Java both have attributes, following these established design
>>>> patterns, I
>>>> don't think there should be any mystery over how they should be
>>>> implemented.
>>>
>>> At the Lang.NEXT conference over the last 3 days, I was able to talk to
>>> many smart people about attributes. But I did find some confusion - are
>>> they best attached to the variable/function (i.e. "storage class"), or
>>> attached to the type ("type constructor")? I think the former.  
>>> Attaching
>>> it to the type leads to all sorts of semantic issues.
>>>
>>> From your list of uses, it looks like attaching it to the variable or
>>> function is an apropos solution.
>>
>> They should be attached to declarations.
>
> The question was whether the declaration affects the type of the  
> declared or not.

For user-defined attributes, no.  This is metadata for the programmer/lib  
to decode.

Obviously, compiler-defined attributes can.

-Steve


More information about the Digitalmars-d mailing list