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: [email protected]
Reporter: [email protected]
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.
--