Sorry, forgot the @property.

On Sun, Feb 3, 2013 at 12:27 PM, Gor Gyolchanyan <
[email protected]> wrote:

> I always wondered if there's a good way to incorporate opOpAssign family
> of operators with the write property syntax.
> Currently, using anything but the direct assignment fails, so even if
> eventually the support for defining specific opOpAssign for properties
> won't be implemented, at least the automatic rewrite of them would be nice:
>
> struct A
> {
> public:
>     int i()
>     {
>         return _i;
>     }
>
>     int i(int i_)
>     {
>         return _i = i_;
>     }
>
> private:
>     int _i;
> }
>
> unittest
> {
>     A a;
>     a.i += 2; // a.i(a.i() + 2);
> }
>
>
> On Sun, Feb 3, 2013 at 12:16 PM, Andrei Alexandrescu <
> [email protected]> wrote:
>
>> Walter and I have had a discussion on how to finalize properties.
>>
>> http://wiki.dlang.org/DIP23
>>
>> We got input from DIP21 (which we didn't want to clobber, hence the new
>> DIP) and the recent discussion.
>>
>> The proposal probably won't be accepted in its current form because it
>> breaks some code. We hope to bring it to good shape with everyone's help.
>>
>> In brief:
>>
>> * Optional parens stay.
>>
>> * Just mentioning a function or method without parens does NOT
>> automatically take its address. (This is a change from the current
>> behavior.)
>>
>> * Read properties (using @property) work as expected with the mention
>> that they may NOT be called with the parens. Any parens would apply to the
>> returned value.
>>
>> * Write properties (using @property) may only be used in the assignment
>> form (no function-style call allowed).
>>
>> It is understood that the current proposal is just a draft and there must
>> be quite a few corner cases it doesn't discuss. We also understand it's
>> impossible to reconcile all viewpoints and please all tastes. Our hope is
>> to get to a point where the rules are self-consistent, meaningful, and
>> complete.
>>
>>
>> Destroy.
>>
>> Andrei
>>
>
>
>
> --
> Bye,
> Gor Gyolchanyan.
>



-- 
Bye,
Gor Gyolchanyan.

Reply via email to