Do we want functions to act as properties, or merely omit parens for ufcs/chaining?
eles
eles at eles.com
Tue Jan 29 00:03:33 PST 2013
On Tuesday, 29 January 2013 at 00:56:41 UTC, Chad Joan wrote:
> Would everyone be able to agree to only use @property functions
> as properties?
I think @property-ies should not be taken for functions... at
least conceptually.
I think the root reason why such confusion is the bad choice that
D made in the beginning, to define properties with the same
syntax as functions, while properties should be rather an
extensions of the variable concept, not of the functions concept.
For the programmer using a property, he should not even be aware
that it is a function (or a property). He should think that it is
a variable and that's all.
The C# syntax is closer to this approach. More, it is strongly
linking the code (of both the getter and the setter) with the
considered property. In D, this link is quite loose.
Let me turn the table: why not thinking about the property as a
variable that, optionally (start another UFCS/opt-parens
discussion here...) accept the syntax:
v(2);
(besides the obvious v=2). This happens in C++ where you can
define either int x= 3; either int x(3).
More confusing?
More information about the Digitalmars-d
mailing list