Hello,

>> $add = | $x |=> | $y : $x |=> $x+$y;
> Not sure that it's really readable.

This is not the most trivial example. In my blog, there is a small
sub-section where I explain why this is more readable than an implementation
with the current syntax. See under "Readability" and "A more complicated
example".

http://linepogl.wordpress.com/2011/08/04/short-closures-for-php-an-implementation/

:-)


Lazare INEPOLOGLOU
Ingénieur Logiciel


Le 4 août 2011 10:50, Frédéric Hardy <frederic.ha...@mageekbox.net> a écrit
:

> Hello !
>
>> I've always thought that just supressing the "function" keyword could work
>> as a shorthand, i.e. having ([param1 [, param2 [, ...]]]){...}. Somewhat
>> similar to Ruby's lambda shorthand:
>> http://slideshow.rubyforge.org/ruby19.html#40
>>
>>
> Huge +1 for that.
> Code using closures will be more readable.
>
>> $add = | $x |=> | $y : $x |=> $x+$y;
>>>>
>>>>
>>> Not sure that it's really readable.
> Moreover, it's more Perl/Ruby way than PHP way.
>
> Best regards,
> Fred
>
> --
> ========================================================================
> Frédéric Hardy : Architecte d'application/Admin. système/Ergonome
>           CV : http://blog.mageekbox.net/public/cv.frederic.hardy.pdf
>         Blog : http://blog.mageekbox.net
>      Twitter : http://twitter.com/mageekguy
> ========================================================================
>
>

Reply via email to