Reddit: why aren't people using D?

Rainer Deyke rainerd at eldwood.com
Mon Jul 27 18:14:10 PDT 2009


Benji Smith wrote:
> For my money, the best solution is a simple "property" keyword as a
> function modifier. Only functions with the "property" modifier would be
> allowed to pose as fields (getters called without parens, setters called
> using assignment syntax). But, in all other respects, they should act
> just like functions.

I like being able to distinguish between the property itself and its
setter/getter function.

For example, let's say 'y' is a property of 'x'.

z = x.y; // Calls the getter.
x.y = z; // Calls the setter.
z = &x.y; // But what's this?  The setter, the getter, or the property
itself?

That's why I support opSet_foo and opGet_foo (although I'd prefer the
simpler get_foo and set_foo).


-- 
Rainer Deyke - rainerd at eldwood.com



More information about the Digitalmars-d mailing list