On 5 April 2012 20:35, Walter Bright <newshound2@digitalmars.com> wrote:
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.

Yes, most certainly the former. The latter is already possible with tricks (a trivial template for instance).
An attribute/annotation should associate with select instances/declarations of things.
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.
Perhaps that's the key distinction between an '@' attribute(/'annotation'?), and a no-'@' attribute?