Proposal: user defined attributes

Walter Bright newshound2 at digitalmars.com
Sat Mar 17 12:56:25 PDT 2012


On 3/16/2012 7:11 AM, Manu wrote:
> attribute myAttribute
> {
>    this(int something);
>
>    bool bNeedsAttention;
>
>    property void refresh(bool bRefresh) { bNeedsAttention = bRefresh; }
> }
>
> @myAttribute(10) int thing;
>
> thing.refresh = true;

Under the hood, where would that per-instance data be stored?

Compile-time annotations can be stored internally to the compiler, but 
per-instance runtime data? How is it connected to the instance? When is it 
constructed and destroyed?


More information about the Digitalmars-d mailing list