On Sunday, 28 December 2014 at 18:16:04 UTC, Andrei Alexandrescu wrote:
"auto" has no meaning there. It does here:

auto ref foo(auto ref int x) { return x; }

This wouldn't compile anymore - inout is needed for x as well.

So are you saying that such code will require the following if this DIP is implemented?

auto ref inout foo(auto ref inout(int) x) { return x; }

The idea is sound but that will be incredibly tedious to type out. I know that Walter wants to infer inout for templates (a good idea), but at some point or another somebody is going to have to type that out for a regular function. Since scope is up in the air right now, could it be redefined to mean `auto ref inout`? It's a bit humourous; `in` would then mean `const auto ref inout`.

Also, I guess this DIP implies that `auto ref` should work for non-templated functions as well. That seems pretty good, but the rvalue ref problem still hasn't been solved, and it's hard to say whether DIP25 would help or hurt prospects for that.

Reply via email to