DIP26: properties defined

Robert jfanatiker at gmx.at
Sat Feb 9 05:58:09 PST 2013


On Sat, 2013-02-09 at 08:28 +0100, deadalnix wrote:
> Taking the address of a property  <= no. It I take the address of 
> an int, I get an int* or an error because it is invalid. Not a 
> delegate !
> No UFCS for properties <= no.
> Behaviour like functions <= WTF should properties behave 
> differently if the return a function ?

You are still thinking of properties as fields. Which does not work
reliable in any proposal and actually can not, that is the reason for
encapsulation in the first place.

My arguments against UFCS for properties make a lot of sense if you
think about it and result in a very clean implementation, with little
breakage and the added benefit of actually having something that
deserves to be called property.

The other proposals try to solve the issue of functions returning
functions being inconsistent across real functions and some property
like thing that tries (badly) to mimic a field, by making property just
more non sensical, instead of tackling the root cause of the problem:

We can not mimic fields and in fact there is absolutely no reason to do
so, if you think about it, you don't really want that, otherwise all
books about OOP would be wrong.



More information about the Digitalmars-d mailing list