Den 2015-09-10 kl. 22:22, skrev Bob Weinand:
Am 10.09.2015 um 22:04 schrieb Björn Larsson <bjorn.x.lars...@telia.com>:
Den 2015-09-03 kl. 00:48, skrev Rowan Collins:
Amendment 3. Make the parentheses around the argument list mandatory so that (if Amendment 1
is also adopted) there is only a single variant of the syntax, namely "( param list )
~> expression".
Any plans to incorporate any of the amendments above in the RFC?
Personally I favour amendment 3. One of your examples would be:
functionreduce(callable $fn){
return($initial)~>($input)~>{
$accumulator=$initial;
foreach($inputas$value){
$accumulator=$fn($accumulator,$value);
}
return$accumulator;};
}
Or maybe I'm just overly familiar having function arguments
within parenthesis ;)
Regards, //Björn Larsson
You are probably just very familiar with them ;-)
It totally isn't unusual to have that (for languages allowing untyped params),
see:
Javascript (ES6)
Hack
C#
(There probably are more, I just can recall these three off my head)
So, I think this very much falls under personal preference.
Bob
Yes, for me it's about not needing to think whether parenthesis
should be there or not. So one more thing to not think about...
Anyway, I noticed that both C# and Hack uses lamda functions for
asynchronous programming, so good to get going with this RFC!
Hack example:
|async (int $x, string $y): Awaitable<Foo> ==> await $x->genFoo($y, $z);
//Björn
|