Release D 2.096.0

starcanopy starcanopy at protonmail.com
Sun Mar 14 03:25:28 UTC 2021


On Saturday, 13 March 2021 at 21:33:20 UTC, Meta wrote:
> On Saturday, 13 March 2021 at 21:15:40 UTC, Martin Nowak wrote:
>> [...]
>
> Allow shortened function implementations for single-expresssion 
> functions.
> -preview=shortenedMethods is added. This allows functions to be 
> written in a similar form to lambda functions:
>
> // these 2 are equivalent
> int foo() { return 1; }
> int foo() => 1;
> The syntax allows the form => expr to replace the function body 
> { return expr; }
>
> Amazing! I had no idea this got in. I love the syntax.

It's pretty neat, but a DIP has to be drafted and approved for it 
to be enabled by default, right? (Unless I missed it.)


More information about the Digitalmars-d-announce mailing list