Hi --

On Fri, 25 Apr 2003, Rene Tschirley wrote:

> Robert Klemme wrote:
> Hmm, the book told me to understand that ruby's association somewhat
> difficult and to use parentheses if needed. Should better give examples
> and explain the parsing. On the other hand, it looks quite similar to
> functional programming. *sigh*

Well, the language has changed in this area, and the book (assuming
you mean the Pickaxe book) is still in its first edition.  Be
patient :-)

Here's an illustration of recent changes, as I understand them....  In
1.6.8, the whitespace between the method call and the arglist was
ignored, but warned about:

  candle:~$ ruby -vwe 'puts(3).class'
  ruby 1.6.8 (2002-12-24) [i686-linux]
  3
  candle:~$ ruby -vwe 'puts (3).class'
  ruby 1.6.8 (2002-12-24) [i686-linux]
  -e:1: warning: puts (...) interpreted as method call
  3

but in 1.8.0, the whitespace is taken to mean that you want the
parenthetical expression to associate to the right:

  candle:~$ ruby/1.8.0/bin/ruby -vwe 'puts(3).class'
  ruby 1.8.0 (2003-03-03) [i686-linux]
  3
  candle:~$ ruby/1.8.0/bin/ruby -vwe 'puts (3).class'
  ruby 1.8.0 (2003-03-03) [i686-linux]
  -e:1: warning: (...) interpreted as grouped expression
  Fixnum


David

-- 
David Alan Black
home: dblack / superlink.net
work: blackdav / shu.edu
Web:  http://pirate.shu.edu/~blackdav