@property - take it behind the woodshed and shoot it?
mist
none at none.none
Fri Jan 25 06:55:08 PST 2013
Meaning of @property for free functions is well-defined. Most
likely because languages like C# does not have UFCS as far as I
rememeber.
I see two possible approaches here:
1)
-----
@property void symbol1(Data);
@property Data symbol1();
Data symbol2;
...
symbol1 = symbol2; // allowed, symbol1 behaves same as symbol2
for user
symbol2.symbol1; // prohibited, symbol1 is semantically a global
variable
-----
2)
-----
@property void symbol1(Data);
@property Data symbol1();
Data symbol2;
...
symbol1 = symbol2; // prohibited, symbol1 has meaning only within
UFCS and imitates Data member.
symbol2.symbol1; // Fine, rewritten as symbol1(symbol2), follows
general property rules but for compound symbol
-----
First one seems more natural to me, but I can live with either
approach. Not both. Also please mote that UFCS is meant for
enhancing data type functionality with free functions, not
implementing every possible feature available to that data type
with native syntax.
More information about the Digitalmars-d
mailing list