Discussion Thread: DIP 1043--Shortened Method Syntax--Final Review

Adam D Ruppe destructionator at gmail.com
Wed Jun 15 13:50:28 UTC 2022


On Wednesday, 15 June 2022 at 13:40:20 UTC, Paul Backus wrote:
> This already works--both for the new syntax, and for the 
> existing arrow-lambda syntax, and even for functions with an 
> explicit `return` statement:

Indeed, though if one of them doesn't return void:

int a() => 0;

void b() => a();

This will "Error: cannot return non-void from `void` function"

You can `void b() => cast(void) a();` to explicitly discard the 
return value and then it builds.

I'm perfectly fine with that the way it is, just mentioning for 
factual completeness.


More information about the Digitalmars-d mailing list