Re: [RFC] Short syntax for anonymous functions
| From: | David Muir | Date: | Thu, 21 Feb 2013 11:17:41 +0000 |
| Subject: | Re: [RFC] Short syntax for anonymous functions | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-66102@lists.php.net to get a copy of this message | ||
On 21/02/2013, at 6:12 AM, Lazare Inepologlou <linepogl@gmail.com> wrote:
> 2013/2/20 Sanford Whiteman <swhitemanlistens-software@cypressintegrated.com>
>
>>> It still looks like some random characters bashed together by a monkey
>>> with a keyboard.
>>
>> +1, I am a fiend for ternary expressions and crazy one-liners, but
>> this makes me want to go back and unroll everything I've ever done
>> into readable code. :)
>>
>> -- S.
>
>
> Long code is not always equivalent to readable code. A shorter syntax could
> improve readability in *some* cases.
>
> Long:
> $users->OrderBy( function( $x ){ return $x->Surname; } );
>
> Short:
> $users->OrderBy( $x ==> $x->Surname );
>
>
>
> Lazare INEPOLOGLOU
> Ingénieur Logiciel
I think your example proves the opposite. The fist example was much easier to read and understand
than the second.
Cheers,
David