On Wed, Apr 9, 2008 at 11:24 PM, Phlip <phlip2005 / gmail.com> wrote:
> > This is one use of method chaining I dislike.
>
>  The use I like is as a DSL. q.left.up.twist.link(q) for a turtle
>  graphics, for example.

This relies, of course, on the convention that each of the methods you
string together returns self (or the turtle in this case).

Smalltalk has a cascade syntax, a series of messages separated by
semicolons are all sent to receiver of the first message in the
series.

   q.left;up;twist;link:q

means the same thing as
   q left
   q up
   q twist
   q llnk:q

or transliterated into Ruby
   q.left;q.up;q.twist;q.link(q)

Of course the semi-colon means something else in Ruby.

-- 
Rick DeNatale

My blog on Ruby
http://talklikeaduck.denhaven2.com/