From: Jim Weirich Date: 2004-08-13T02:28:36+09:00 Subject: Re: Reasons for precedence? (Was: Curly syntax for muliline blocks...) Mark Hubbart said: [... examples elided ...] > I realize this particular example is rather contrived, but obviously > these things pop up from time to time in one's code. Is there any > particular reason that do...end blocks were given different precedence > from {...} blocks? Given def g() 1 end def f(n) yield(n) end f g do |x| puts "Got #{x}" end # => Got 1 f g { |x| puts "Got #{x}" } # fails Prints ... Got 1 x.rb:2:in `f': no block given (LocalJumpError) from x.rb:5 In Rake, do/end work better with idiomatic rake usage than the curly version. (See http://rake.rubyforge.org/files/doc/rakefile_rdoc.html at the bottom of the page). -- -- Jim Weirich jim@weirichhouse.org http://onestepback.org ----------------------------------------------------------------- "Beware of bugs in the above code; I have only proved it correct, not tried it." -- Donald Knuth (in a memo to Peter van Emde Boas)