digitalmars.D.bugs - [Issue 16271] New: Should be able to express that a lambda returns
- via Digitalmars-d-bugs (25/25) Jul 12 2016 https://issues.dlang.org/show_bug.cgi?id=16271
https://issues.dlang.org/show_bug.cgi?id=16271 Issue ID: 16271 Summary: Should be able to express that a lambda returns by reference Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: enhancement Priority: P1 Component: dmd Assignee: nobody puremagic.com Reporter: andrei erdani.com This literal takes one parameter by ref and the other by value, and returns by value: (ref x, y) { x += y; return x; } function (ref x, y) { x += y; return x; } // alternative There is no way to specify that we want it to return e.g. x by reference. These syntaxes do not work: function ref (ref x, y) { x += y; return x; } function ref typeof(x) (ref x, y) { x += y; return x; } I think the first one should work. For that, the "return" attribute will also be deduced. --
Jul 12 2016