On Friday, 1 February 2019 at 11:48:51 UTC, Timon Gehr wrote:
On 01.02.19 10:10, 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:

{
   auto __temp = pt.x;
   doubleMyValue(__temp);
   pt.x = __temp;
}

I believe this is something along the lines of what Swift and C# do as well.

Or something... a DIP to fix properties anyone? :)

http://wilzbach.github.io/d-dip/DIP24

I'm not sure your rewrite is good though, because it does not preserve aliasing during the function call.

You mean if __temp is modified in the doubleMyValue and pt.x aliases something else? Or? Wouldn't the assignment back "just work"?

And is there a rewrite that would work then?

Reply via email to