<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">2013/2/4 Andrei Alexandrescu <span dir="ltr"><<a href="mailto:SeeWebsiteForEmail@erdani.org" target="_blank">SeeWebsiteForEmail@erdani.org</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"><div class="im">
On 2/3/13 11:00 PM, David Nadlinger 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"><br></blockquote>
</div><div class="im">
<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">
Now, grouping the expression »&a.b« according to the precedence rules<br>
yields »&(a.b)« – but in your proposal, they mean completely different<br>
things.<br>
</blockquote>
<br></div>
I agree they mean different things. I'm unclear that's a problem. All your examples stop here, there's no propagation of the issue. To take the address of a property, one writes &obj.prop. To take the address of a property's result, one writes &(obj.prop). And that's that. It all works with typeof.</blockquote>
<div><br></div><div>If the expression is generated from string mixin, might have a problem.</div><div><br></div><div>// This is much simple case. Real example might be more complicated.</div><div>template AddressOf(string exp)</div>
<div>{</div><div> enum AddressOf = "&" ~ exp;</div><div>}</div><div>struct S {</div><div> @property int prop() { return 1; }</div><div>}</div><div>void main() {</div><div> S s;</div><div> assert(s.prop == 1);</div>
<div> int* p = mixin(AddressOf!("s.prop")); // &s.prop returns delegate</div><div>}</div><div><br></div><div>I think that parenthesis-dependent syntax is not good.</div><div><br></div><div>Kenji Hara</div>
</div></div></div>