[Issue 20238] Add ability to specify ref argument for single-parameter lambdas without parentheses

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Mar 4 15:38:35 UTC 2021


https://issues.dlang.org/show_bug.cgi?id=20238

Andrei Alexandrescu <andrei at erdani.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |andrei at erdani.com
         Resolution|---                         |INVALID

--- Comment #3 from Andrei Alexandrescu <andrei at erdani.com> ---
In the notation

    ref elem => elem.x = 1

it is unclear whether `ref` refers to the return value of the lambda or the
parameter. These do work:

    (ref elem) => elem.x = 1
    ref (elem) => elem.x = 1

(The second would be rejected because it returns a reference to a local.)

I'll close this, please reopen if appropriate.

--


More information about the Digitalmars-d-bugs mailing list