Why are there Properties in D?

Daniel Murphy yebbliesnospam at gmail.com
Fri Feb 14 03:12:56 PST 2014


"Robin"  wrote in message news:beuazddmthazioufmnne at forum.dlang.org...

> But what about Properties - the feature where functions can be
> called as if they were member variables ...
> Isn't this a step backwards if you think about the sentence above?

Language design is a balancing act and there are always trade-offs.  In this 
case it was decided the benefit outweighed the cost (eg now you can easily 
instrument field access)

With operator overloading, there are many other places where the syntax 
hides function calls of arbitrary complexity.

You are of course free to avoid any/all of these features in your own code 
if you think it is better that way. 



More information about the Digitalmars-d mailing list