Le 18/03/2012 05:49, Walter Bright a écrit :
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.

The attribute itself doesn't do anything at runtime. But the attribute should be able to modify what is qualified before it is compiled.

With that model it is much simpler, it open the door to AOP, and it allow us to implement as lib many feature that would have required compiler support before.

AS mentioned deprecated, synchronized and override (including the recent propagation of @safe, pure, nothrow that have made so much noise) could have been implemented with no compiler changes with a good @property/@annotation support. This tells us quite a lot about its usefulness and how much powerful it is.

Probably as powerful as templates are, and close to nuclear power combined with template.

Reply via email to