Re: [RFC] [Discussion] Short Closures

From: Date: Thu, 10 Sep 2015 20:22:06 +0000
Subject: Re: [RFC] [Discussion] Short Closures
References: 1 2 3 4  Groups: php.internals 
Request: Send a blank email to internals+get-88148@lists.php.net to get a copy of this message
> Am 10.09.2015 um 22:04 schrieb Björn Larsson <bjorn.x.larsson@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

« previous php.internals (#88148) next »