On 12/27/14 10:09 PM, Andrei Alexandrescu wrote:
Walter and I have been working on revamping DIP25, which focuses on
tightening the screws of ref. This should then simplify DIP69
significantly.

Please comment: http://wiki.dlang.org/DIP25

ref int hun() inout { return b; }

This doesn't make sense. inout cannot cast to mutable.

Other than that, there is an issue with taking ref mutable parameters.

For example, you cannot implement an increment function:

ref int increment(ref int x) { return ++x;}

marking x as inout makes it effectively const during the body of the function, so such a function would be banned. I'm sure there are some of these in some code somewhere, I wouldn't be surprised if phobos had some.

I like the idea of inferring lifetime based on inout, and I think that connection is sound. But I don't like the idea of *requiring* inout to qualify ref returns of parameters. It's too restrictive.

-Steve

Reply via email to