Discussion Thread: DIP 1043--Shortened Method Syntax--Final Review
bauss
jj_1337 at live.dk
Thu Jun 16 06:54:39 UTC 2022
On Wednesday, 15 June 2022 at 13:40:20 UTC, Paul Backus wrote:
> ...
On Wednesday, 15 June 2022 at 13:49:04 UTC, Steven Schveighoffer
wrote:
> ...
Thank you, like I said I wasn't sure if that was supported by the
name of `AssignExpression` and whether it would work, but seems
like everything is good.
So from my point of view then everything is okay.
On Wednesday, 15 June 2022 at 13:50:28 UTC, Adam D Ruppe wrote:
> 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.
I'm perfectly fine with this not working, because I think that
could lead to subtle bugs.
I'm a strong believer of that if a function returns a value then
you must use that value and should only discard it if absolutely
necessary or if you're debugging.
More information about the Digitalmars-d
mailing list