On Wed, Mar 13, 2019 at 4:26 PM Travis van der Font <travis.f...@gmail.com> wrote:
> Arrow functions are ternary operators to functions. > While they are nice and shorten, they can be hard to read at times; > considerably to people who aren't used to them which is surprisedly a > majority of PHP programmers. > > Having them optional sure, but not necessary. > > Feel free to decide between fn() or f() as both are equivalently > comprehensible to the same level of minimalism. > Anyone considered? ($x) => $x * $multiplier > > I use this format a lot in javascript, so I like not having any indicator. I can't remember which language it was, but they didn't even require the parentheses if there was only a single input: $x => $x * $multiplier; > #mytwocents > > Kind regards / Léif Gréiss, > Travis van Font > > > Le mer. 13 mars 2019 à 16:57, Nikita Popov <nikita....@gmail.com> a écrit > : > > > Hi internals, > > > > Motivated by the recent list comprehensions RFC, I think it's time we > took > > another look at short closures: > > > > https://wiki.php.net/rfc/arrow_functions_v2 > > > > This is based on a previous (withdrawn) proposal by Levi & Bob. It uses > the > > syntax > > > > fn($x) => $x * $multiplier > > > > and implicit by-value variable binding. This example is roughly > equivalent > > to: > > > > function($x) use($multiplier) { return $x * $multiplier; } > > > > The RFC contains a detailed discussion of syntax choices and binding > modes. > > > > Regards, > > Nikita > > > -- -- Chase chasepee...@gmail.com