<div dir="ltr">I always wondered if there's a good way to incorporate opOpAssign family of operators with the write property syntax.<div style>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:</div>
<div style><br></div><div style>struct A</div><div style>{</div><div style>public:</div><div style>    int i()</div><div style>    {</div><div style>        return _i;</div><div style>    }</div><div style><br></div><div style>
    int i(int i_)</div><div style>    {</div><div style>        return _i = i_;</div><div style>    }</div><div style><br></div><div style>private:</div><div style><div>    int _i;</div></div><div style>}</div><div style>
<br></div><div style>unittest<br>{</div><div style>    A a;</div><div style>    a.i += 2; // a.i(a.i() + 2);<br>}</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sun, Feb 3, 2013 at 12:16 PM, Andrei Alexandrescu <span dir="ltr"><<a href="mailto:SeeWebsiteForEmail@erdani.org" target="_blank">SeeWebsiteForEmail@erdani.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Walter and I have had a discussion on how to finalize properties.<br>
<br>
<a href="http://wiki.dlang.org/DIP23" target="_blank">http://wiki.dlang.org/DIP23</a><br>
<br>
We got input from DIP21 (which we didn't want to clobber, hence the new DIP) and the recent discussion.<br>
<br>
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.<br>
<br>
In brief:<br>
<br>
* Optional parens stay.<br>
<br>
* Just mentioning a function or method without parens does NOT automatically take its address. (This is a change from the current behavior.)<br>
<br>
* 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.<br>
<br>
* Write properties (using @property) may only be used in the assignment form (no function-style call allowed).<br>
<br>
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.<br>

<br>
<br>
Destroy.<span class="HOEnZb"><font color="#888888"><br>
<br>
Andrei<br>
</font></span></blockquote></div><br><br clear="all"><div><br></div>-- <br>Bye,<br>Gor Gyolchanyan.
</div>