2013/2/4 Andrei Alexandrescu <SeeWebsiteForEmail@erdani.org>
On 2/3/13 11:00 PM, David Nadlinger wrote:

Now, grouping the expression »&a.b« according to the precedence rules
yields »&(a.b)« – but in your proposal, they mean completely different
things.

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.

If the expression is generated from string mixin, might have a problem.

// This is much simple case. Real example might be more complicated.
template AddressOf(string exp)
{
    enum AddressOf = "&" ~ exp;
}
struct S {
    @property int prop() { return 1; }
}
void main() {
    S s;
    assert(s.prop == 1);
    int* p = mixin(AddressOf!("s.prop"));  // &s.prop returns delegate
}

I think that parenthesis-dependent syntax is not good.

Kenji Hara