new DIP5: Properties 2

Jarrett Billingsley jarrett.billingsley at gmail.com
Mon Jul 27 19:17:37 PDT 2009


On Mon, Jul 27, 2009 at 9:33 PM, Benji Smith<dlanguage at benjismith.net> wrote:

> But I think the same thing can be more elegantly written using the
> "property" keyword:
>
>  private int _x;
>  public property int X() { return _x; }
>  protected property X(int value) { _x = value; }
>
> The only disadvantage I see there is the introduction of a keyword. And
> that's definitely a disadvantage. But, compared to the "op" syntax, I think
> it's the lesser of two evils.

Oh, I agree with you; out of all the proposals, the 'property'
attribute is the cleanest.  I just wanted to clear up some
misconceptions about the opGet/Set proposal :)



More information about the Digitalmars-d mailing list