Remus

Namespace rswhite4 at googlemail.com
Wed Nov 21 12:48:39 PST 2012


> A property shortcut syntax would be cool to have.
>
> class Foo
> {
>     @property int bar;
> }
>
> Lowered to:
>
> class
> {
>     private int bar_;
>
>     @property int bar () { return bar_; }
>     @property int bar (int value) { return bar_ = value; }
> }
>
> It would also be nice if you could manually implement any of 
> the getter or setter and none would be generated in that case.
Hm, I like the Idea.
But I would prefer:
private:
     int _bar in(int val) {
         _bar = val;
     } out {
         return _bar;
     }
which results in:
private:
      int _bar;

      @property int bar() { return _bar_; }
      @property void bar(int val) { _bar = val; }



More information about the Digitalmars-d-announce mailing list