Re: [RFC] Short syntax for anonymous functions
| From: | Marcello Duarte | Date: | Tue, 19 Feb 2013 16:31:39 +0000 |
| Subject: | Re: [RFC] Short syntax for anonymous functions | ||
| References: | 1 2 3 4 5 6 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-65965@lists.php.net to get a copy of this message | ||
On 19 Feb 2013, at 16:29, Morfi wrote:
> ($n) => { echo $n; }
> ($n) use ($m) => { echo $n; }
Morfi, the problem pointed out already is when you have no arguments it would be the same as the
statement block, which would cause BC issues.
> On Tue, Feb 19, 2013 at 8:11 PM, Levi Morrison <morrison.levi@gmail.com>wrote:
>
>>> IF (and I stress if) we add a a shorter anonymous function syntax I'd
>>> like it to be geared towards one-liners because that's where the
>>> current syntax feels really verbose, especially when you close over
>>> other variables:
>>>
>>> function ($n) use ($m) { return $m * $n; }
>>>
>>> Versus one potential option:
>>>
>>> ($value) |$m| => $m * $n;
>>
>> My apologies, this was meant to read:
>>
>> ($n) |$m| => $m * $n;
>>
>> --
>> PHP Internals - PHP Runtime Development Mailing List
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>
>
> --
> Best regards, Andrey
--
Marcello Duarte
marcello.duarte@gmail.com
http://marcelloduarte.net