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

deadalnix deadalnix at gmail.com
Fri Jan 25 01:16:34 PST 2013


On Friday, 25 January 2013 at 09:12:47 UTC, Jacob Carlborg wrote:
> On 2013-01-24 17:29, Andrei Alexandrescu wrote:
>
>> That means there must be two overloads of f exactly:
>>
>> T f();
>> f(T);
>
> That's somewhat problematic since it won't allow chaining 
> assignments:
>
> auto i = f = 3;
>
> We need to either allow:
>
> T f ();
> T f (T);
>
> Or implement some form of rewrite:
>
> f = 3; // calls setter
> auto i = f; // calls getter
>
> This is the preferred solution.

Assignation is right associative, so it is equivalent to :
auto i = (f = 3);

The setter is called.


More information about the Digitalmars-d mailing list