http://d.puremagic.com/issues/show_bug.cgi?id=9062
--- Comment #14 from Kenji Hara <k.hara...@gmail.com> 2012-12-05 16:26:04 PST --- (In reply to comment #13) > C++ has one special case where (e) means something different from e. (Few > people know that case exists.) > > Adding such to D makes me very nervous. I think it's a sound principle that > any > expression can be parenthesized without altering its meaning, it's important > for anything that generates source code (like mixins are wont to do). It's sure. But, &propfunc is one of the key point for the more property enforcement. - If &propfunc returns an address of returned value, all function related meta templates will be broken (e.g. FunctionTypeOf). - If &propfunc returns a function pointer of propfunc, all semantics are kept intact. But, to get an address of returned value from propfunc will become impossible in range of using built-in-language features. I have thought a library solution, but this is ugly to me. import std.algorithm : move; T identity(T)( T t) { return move(t); } ref T identity(T)(ref T t) { return t; } int g; @property ref int propfunc() { return g; } void main() { auto p1 = &propfunc; // p1 is function pointer auto p2 = &identity(propfunc); // p2 is int* // identity(propfunc) makes an expression, // then getting an address of returned value can be succeeded. assert(p2 == &g); } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------