http://wiki.dlang.org/DIP25

Peter Alexander via Digitalmars-d digitalmars-d at puremagic.com
Sun Dec 28 02:13:44 PST 2014


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

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?


More information about the Digitalmars-d mailing list