On Tue, 10 Apr 2012 06:32:00 -0400, Timon Gehr <timon.g...@gmx.ch> wrote:
On 04/10/2012 12:18 AM, Walter Bright wrote:
But you said it was added to the *type*.
What I said was that it is added to the declaration. If the declaration
happens to declare a type, then that must affect the type:
@attr(foo) struct Foo{} // annotate 'foo'
@attr(bar) Foo x;
__traits(getAttributes, typeof(x)); // this will find 'foo', but no 'bar'
__traits(getAttributes, x); // this will find 'bar', but not 'foo'
I should clarify that it's *associated* with the type. It should not
affect the type in how it functions, at all. For all usages of Foo except
to get attributes associated with its declaration, it should be treated as
if it doesn't have an attribute on it.
So it doesn't affect how the type operates or how it's matched, etc.
except in the capacity that you query its attributes.
-Steve