Discussion Thread: DIP 1043--Shortened Method Syntax--Community Review Round 1
Max Samukha
maxsamukha at gmail.com
Tue Feb 8 09:31:04 UTC 2022
On Saturday, 5 February 2022 at 16:19:42 UTC, Doigt wrote:
> Except commonly, and to take two popular examples: JavaScript
> and C#, the arrow notation is not understood to be a shorthand
> for a return expression but just an expression.
https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/operators/lambda-expressions#expression-lambdas:
"An expression lambda *returns* the result of the expression..."
> I don't think I'll use this new feature if I can't make my code
> base consistent in style. It makes no sense to me to have
> things like
> int myFunc (int a) => something;
> void myProc (int a) { something; }
The former is equivalent to int myFunc (int a) { return
something; }. The latter - void myProc (int a) { something;
return; }.
> it looks bad and it makes it seems like void is a special case
> that is not immediately obvious why the arrow notation is not
> used.
More information about the Digitalmars-d
mailing list