<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">2013/1/25 Walter Bright <span dir="ltr"><<a href="mailto:newshound2@digitalmars.com" target="_blank">newshound2@digitalmars.com</a>></span><br><blockquote class="gmail_quote" style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
On 1/24/2013 5:15 PM, kenji hara wrote:<br>
<blockquote class="gmail_quote" style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
1. Optional parentheses for normal functions should work shallowly IMO.<br>
2. Optional parentheses for property functions should not work. Applying () for<br>
property function name always applied to its returned value.<br>
<br>
#1 is a ratification of current behavior. It allows the combination of UFCS and<br>
removing redundant ()s.<br>
#2 is a breaking change. If we need it, community consent is required.<br>
</blockquote>
<br>
There is a way to do #2 without breaking existing code.<br>
<br>
Create a new property attribute, say, @prop. Imbue it with the new behavior. Leave the old @property as it is, and let it cycle through the usual warning, deprecation, removal process.<br></blockquote><div><br></div><div>
Instead, we can simply change the semantic behavior, when -property switch is specified.</div><div>Because -property switch should have been used for enabling "experimental feature".</div><div><br></div><div>In phobos, we need to care the semantic change by adding `static if` branches.</div>
<div><div>By the following code we can detect whether the -property switch is really specified or not.</div><div><br></div><div>enum enforceProperty = !__traits(compiles, {</div><div>    int prop(){ return 1; }</div><div>
    int n = prop;</div><div>});</div></div><div><br></div><div>Kenji Hara</div></div></div></div>