User attributes (was Proposal on improvement to deprecated)

Jacob Carlborg doob at me.com
Mon Oct 3 23:26:26 PDT 2011


On 2011-10-03 21:54, bearophile wrote:
> 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

Template mixins can do (most of) the other things suggested in this 
thread as well, except for your suggestion. But it's not pretty.

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list