@property - take it behind the woodshed and shoot it?

deadalnix deadalnix at gmail.com
Fri Jan 25 07:05:10 PST 2013


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/kdqrnl$13ft$1@digitalmars.com?page=3#post-uagknsecziepoedcabvr:40forum.dlang.org


More information about the Digitalmars-d mailing list