On Friday, 25 January 2013 at 14:55:09 UTC, mist wrote:
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.

See what is proposed here : http://forum.dlang.org/thread/[email protected]?page=3#post-uagknsecziepoedcabvr:40forum.dlang.org

Reply via email to