2013/2/21 Levi Morrison <morrison.l...@gmail.com>

> On Thu, Feb 21, 2013 at 4:17 AM, David Muir <davidkm...@gmail.com> wrote:
> >
> > On 21/02/2013, at 6:12 AM, Lazare Inepologlou <linep...@gmail.com>
> wrote:
> >
> >> 2013/2/20 Sanford Whiteman <
> swhitemanlistens-softw...@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. :)
> >>>
> >>
> >> 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 );
> >>
> >
> > I think your example proves the opposite. The fist example was much
> easier to read and understand than the second.
> >
>
> Obviously that's up to interpretation; I think the second is better
> though I don't understand why `==>` is there instead of something
> simpler.
>

It's just an example, and it's not important. I wanted to use something
that is similar to the key-value mapping operator, but not the same.

What is important is that the short version is declarative: emphasis is put
to what to do, not how to do it. The mechanics are not exposed, and this is
why some may find it harder to understand at first sight.


Lazare INEPOLOGLOU
Ingénieur Logiciel

Reply via email to