[#1816] Ruby 1.5.3 under Tru64 (Alpha)? — Clemens Hintze <clemens.hintze@...>

Hi all,

17 messages 2000/03/14

[#1989] English Ruby/Gtk Tutorial? — schneik@...

18 messages 2000/03/17

[#2241] setter() for local variables — ts <decoux@...>

18 messages 2000/03/29

[ruby-talk:02159] Re: parse bug in 1.5

From: matz@... (Yukihiro Matsumoto)
Date: 2000-03-25 17:04:17 UTC
List: ruby-talk #2159
Hi,

In message "[ruby-talk:02157] parse bug in 1.5"
    on 00/03/26, Mirko Nasato <mirko.nasato@libero.it> writes:

|Ruby 1.5 seems to have a problem when parsing methods called
|with a {...} block if there is space before the opening paren.

It's not a bug.  It is a bad feature which I'm thinking about
improvement, and not yet come to conclusion. ;-)

In 1.4.x, identifiers followed by parenthesises is considered as
method invocation.  In 1.5.x, if whitespaces comes between identifiers
and parenthesises, parenthesises are considered as expression
grouping, to enable:

  point.move (1+3)*2, 5

They are parsed like this (parenthesises added):

|  point.move (1+3)*2, 5

  point.move((1+3)*2), 5        # => 1.4.3 error

  point.move((1+3)*2, 5)        # => 1.5.3 OK


|  greet ("Matz") { "Ciao" }
|
|    => Ciao Matz!   # ruby 1.4.3 (1999-12-08)

  greet("Matz"){ "Ciao" }	#=> OK

|    => parse error  # ruby 1.5.3 (2000-03-23)

  greet(("Matz"){ "Ciao" })	#=> error

|  greet () { "Hello" }
|
|    => Hello world! # ruby 1.4.3 (1999-12-08)

  greet(){ "Hello" }		#=> OK

|    => parse error  # ruby 1.5.3 (2000-03-23)

  greet((){ "Hello" }) 		#=> error

|  greet "Matz" { "Ciao" }

  greet("Matz"{ "Ciao" }) 	#=> error

							matz.

In This Thread