User attributes (was Proposal on improvement to deprecated)

bearophile bearophileHUGS at lycos.com
Mon Oct 3 12:54:03 PDT 2011


Jacob Carlborg:

> I would like to have something similar as this possible as well:
> 
> class Foo
> {
>      @get_set int x;
> }
> 
> Would insert a getter and setter for "x" like this:
> 
> class Foo
> {
>      int x_;
> 
>      int x () { return x_; }
>      int x (int x) { return x_ = x; }
> }

I think a template mixin is already able to do this.

Bye,
bearophile


More information about the Digitalmars-d mailing list