On 12/28/14 2:13 AM, Peter Alexander wrote:
On Sunday, 28 December 2014 at 03:09:20 UTC, Andrei Alexandrescu wrote:
Please comment: http://wiki.dlang.org/DIP25

This seems like it may be painful (in terms of breaking existing code):

"Member functions of structs must qualify this with inout if they want
to return a result by ref that won't outlive this."

This breaks all ranges that return ref front, no? (assuming they aren't
qualified inout, which appears to be the case in the majority of ranges
in std.algorithm/range).

Very little breakage I can think of. Ranges usually don't own their payload.

Clarification: how does this DIP play with auto ref returns? Infer
non-ref if not qualified inout?

auto ref foo(ref int x) { return x; }  // non-ref due to lack of inout
on x?

"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.


Andrei

Reply via email to