Discussion Thread: DIP 1043--Shortened Method Syntax--Community Review Round 1
forkit
forkit at gmail.com
Sat Feb 5 20:47:02 UTC 2022
On Saturday, 5 February 2022 at 20:15:33 UTC, Ola Fosheim Grøstad
wrote:
> On Saturday, 5 February 2022 at 14:10:51 UTC, Paul Backus wrote:
>> D already supports this shortened syntax for anonymous
>> functions:
>>
>> (int x) { return x + 1; }
>> (int x) => x + 1
>>
>> So, allowing it for named functions too is a logical extension
>> of a language feature that already exists.
>
> Hardly, I would read arrow as a math-like lambda by convention.
The proposal seems straight forward to me:
auto multiplyBy10 = (int a) => a * 10; // already exists.
auto multiplyBy10(int x) => x * 10; // proposed: Shortened Method
Syntax
Nothing to see here.
Just do it.
More information about the Digitalmars-d
mailing list