On 29/10/05, Trans <transfire / gmail.com> wrote:
>
> Martin DeMello wrote:
> > David A. Black <dblack / wobblini.net> wrote:
> > >
> > > I think what's happening is that people who've used Ruby for a while
> > > get used to it, and then they sort of shift their readability
> > > threshold.  In other words, if you've seen this:
> > >
> > >    a.map {|b| b.meth }
> > >
> > > for several years, then even though it looked beautiful and concise
> > > and transparent to you at first, it will start to look verbose and
> > > syntactically inefficient.  So then you might want to have:
> >
> > I usually come around to agreeing with you that so-and-so change adds
> > more line noise than is worth it, but this particular one I've disliked
> > right from the beginning. It's not just the visual clutter, it's the
> > conceptual overhead of introducing a new variable merely because ruby
> > has to attach a method to something. Note the progression from
> >
> > ary.sort {|a,b| a.meth <=> b.meth}
> > ary.sort_by {|a| a.meth}
> > ary.sort_by :meth
>
> Shall I be so bold:
>
>   ary.sort_by.meth
>
> ;)
>
> T.
>

If you are so bold, I have to chime in again to say that

  ary.sort_by :meth

reads a lot better than

  ary.sort_by.meth

because we don't do method chaining here.

Sorry, could not resist. ;-)

best regards,

Brian

--
http://ruby.brian-schroeder.de/

Stringed instrument chords: http://chordlist.brian-schroeder.de/