The problem with @properties in D

Robert Jacques sandford at jhu.edu
Mon Dec 12 21:05:27 PST 2011


On Mon, 12 Dec 2011 19:25:33 -0500, Mehrdad <wfunction at hotmail.com> wrote:
> In every language I've seen that has "properties" (C#, Python), they are:
>
>      - _Defined_ like methods
>      - _Used_ like variables
>
> The trouble is, this isn't true with D.

Neither is it true (by your definition) in a lot of other languages (Ruby, Eiffel) which have properties. D originally implemented a concept called Methods-as-Properties, which in terms of paradigms lies somewhere between "properties" and the "Uniform access principle". This naturally caused a bunch of cognitive dissonance for people coming from C#/python, which lead to the introduction of @property. Originally, @property and MaP were suppose to co-exist. As this was a compromise, the property can-of-worms occasionally gets re-opened in these forums.


More information about the Digitalmars-d mailing list