On Fri, Jul 24, 2009 at 2:44 PM, Walter Bright<[email protected]> wrote: > Michiel Helvensteijn wrote: >> >> That's just a few reasons right there. D's properties lack elegance and >> they >> lack potential. > > Let's start with: > > 1. What is a property?
""" Properties are members that provide a flexible mechanism to read, write, or compute the values of private fields. Properties can be used as though they are public data members, but they are actually special methods called accessors. This enables data to be accessed easily while still providing the safety and flexibility of methods. """ -- thanks MSDN > 2. How is that different from, say, a pure function? Properties behave semantically like fields, but are implemented like functions enabling them to do arbitrary calculation on the side when the field is read from or written to. Pure functions are totally different. First, half of the property syntax is about mutating a state. That's obviously not pure. And on the get() side its returning the value of a mutable state, so again, not pure. --bb
