[prev in list] [next in list] [prev in thread] [next in thread] 

List:       ruby-core
Subject:    Re: parser bug, function call without parens across multiple lines
From:       David Smiley <dsmiley () mitre ! org>
Date:       2006-02-27 19:48:25
Message-ID: 9482CEAC-D2E0-4764-BADA-ECAFE111F942 () mitre ! org
[Download RAW message or body]

First of all, I'd like to apologize because my bug report was  
actually against Ruby 1.8.2, not 1.8.4.  I should of been more  
thorough and had my co-worker validate that his Ruby version was what  
he claimed it was.

I have since upgraded my ruby:  ruby 1.8.4 (2005-12-24) [powerpc- 
darwin8.4.0]

As it turns out:

puts Class.new {
   def to_s
      'no bug'
   end
}.new

Will return 'no bug', as I intuitively expect, and so will the one- 
liner:

puts Class.new { def to_s; 'no bug'; end  }.new

But the do-end version:

puts Class.new do
   def to_s
      'no bug'
   end
end.new

has the same error I originally reported, and so does the one-liner  
version of the same:

puts Class.new do def to_s; 'no bug'; end; end.new

Unlike in 1.8.2, the one line versus multiline are consistent -- that  
is good and intuitive.

Thanks, Stegan, for pointing me to the end of:
http://rake.rubyforge.org/files/doc/rakefile_rdoc.html

I'm not sure exactly what to think of this behavior (I have not  
written my own parser ... so my expectation may be unrealistic)...   
but it does not "feel right" to me, FWIW.

~ David Smiley

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic