On Tuesday, 12 February 2013 at 15:53:57 UTC, Namespace wrote:
Don't get me wrong, I also hope that this unfortunate and lengthy discussion ends. And I also like the idea that const ref works as in C++. But I'm sure you can convince neither Walter nor Andrei still the core developer team.

I tried my best a while back, but they sadly didn't take part in the discussion. Just in case, it's summarized in http://forum.dlang.org/thread/[email protected]. I could live with 'const auto ref' too, but I'd hate having to type these 5 additional characters every time. ;)

And I don't quite understand what speaks against my suggestion.
If the compiler decides that by value is a better solution, then structs are received by value, otherwise by ref. But the user don't need to worry about it, because, whatever the compiler may decide to do, he adapt calls to these functions automatically.

Your proposal, if I understood correctly, restricts deadalnix' approach to rvalues only and additionally requires changing the param from 'A' to 'A&'. But iirc rvalues are already passed directly (moved) in D, i.e., they are not copied - so your approach is 1) simply not needed and 2) would require the A -> 'A&' transform (similar to A -> 'auto ref A').

It is in principle nothing more than what you want.

No, nothing more, but it's already covered by D, without special syntax. I'd like to see 1) the move optimization applied to safe lvalue cases as well, also without requiring syntactic changes; 2) Kenji's 'auto ref' proposal getting pulled in the near future so that we can manually prevent argument copying for the remaining unsafe lvalue cases.

Reply via email to