On Friday, 1 February 2019 at 09:10:15 UTC, aliak wrote:
Shouldn't doubleMyValue(pt.x) be a compiler error if pt.x is a
getter? For it not to be a compile error pt.x should also have
a setter, in which case the code needs to be lowered to
something else:
The thing is, D doesn't really differentiate between a getter and
any other method.
So with DIP-1016, when given
doubleMyValue(pt.x);
The compiler would assume the programmer means
- Call pt.x()
- Store the result in a temporary
- Pass that temporary as a ref parameter to doubleMyValue
At no point is the compiler aware that the user intends for x to
be interpreted as a getter.