Proposal: user defined attributes

Walter Bright newshound2 at digitalmars.com
Sat Mar 17 21:49:48 PDT 2012


On 3/17/2012 9:12 PM, F i L wrote:
> Walter Bright wrote:
>> I also do not get why per-instance attributes even exist, as I agree that's
>> what fields are for.
>
> Attributes are per-type (type properties, methods, etc), not per-instance, and
> only accessible (in C#) through type reflection (to my knowledge). According to
> http://msdn.microsoft.com/en-us/library/z919e8tw(v=vs.80).aspx attribute objects
> aren't constructed until reflected upon.

My impression is it is just obfuscation around a simple lazy initialization pattern.

While I can see the abstraction usefulness of compile time attribute metadata, I 
am having a hard time seeing what the gain is with runtime attributes over more 
traditional techniques.


More information about the Digitalmars-d mailing list