DIP26: properties defined

Robert jfanatiker at gmx.at
Sun Feb 10 02:43:04 PST 2013


> // this is a property
> int foo() {...}
It is, if you consider properties to be functions that can be called
without parentheses. Which is quite a lame definition of property if you
ask me.

But yeah my proposal makes properties to be considered functions, just
with some guarantees regarding encapsulation and the special syntax that

prop=a;

means: prop(a);

Actually Michel Fortin summarizes the DIP quite to the point:

> So in short, this proposal is that @property does only two things
when 
> applied to a function: it enables the setter syntax and it changes
the 
> overload rules.
> 

In addition it restricts the setter syntax (prop=a) to be interpreted in
a non UFCS way, meaning there will be no setter methods with two
parameters. (Not accounting for the implicit this parameter)



More information about the Digitalmars-d mailing list