The problem with @properties in D

Somedude lovelydear at mailmetrash.com
Tue Dec 13 10:13:26 PST 2011


Le 13/12/2011 17:15, Robert Jacques a écrit :
> On Tue, 13 Dec 2011 07:25:10 -0500, Somedude
>> My question is: what is the use case for properties in D ?
> 
> The original use case for properties (in general) was to allow source
> level compatibility when one re-factored a public field from a variable
> to a method. Since then, properties have become a common tool to hide
> fields from the public interface (to allow for overloading, etc) but
> retain field like syntax. In D, the technical use case for @property was
> to resolve an ambiguity when re-factoring a zero argument delegate field
> to a method. Also, there was a cognitive dissonance between D's
> properties and those of C# and python.

Thank you.


More information about the Digitalmars-d mailing list