<div class="gmail_quote">On 5 April 2012 20:35, Walter Bright <span dir="ltr"><<a href="mailto:newshound2@digitalmars.com">newshound2@digitalmars.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">On 4/5/2012 5:00 AM, Manu wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
C# and Java both have attributes, following these established design patterns, I<br>
don't think there should be any mystery over how they should be implemented.<br>
</blockquote>
<br></div>
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.<br>
<br>
>From your list of uses, it looks like attaching it to the variable or function is an apropos solution.<br>
</blockquote></div><br><div>Yes, most certainly the former. The latter is already possible with tricks (a trivial template for instance).</div><div>An attribute/annotation should associate with select instances/declarations of things.</div>
<div>I don't think it should affect the type, although this shows a conceptual problem when referring to existing attributes via the same terminology. Obviously one might consider 'const', 'pure', etc attributes themselves, and they clearly do affect the type.</div>
<div>Perhaps that's the key distinction between an '@' attribute(/'annotation'?), and a no-'@' attribute?</div>