From: dblack@... Date: 2006-12-21T02:01:51+09:00 Subject: Re: ruby gotchas Hi -- On Thu, 21 Dec 2006, Brad Phelan wrote: > Mark Guzman wrote: >> I've written up some ruby gotchas that have come up while using ruby. >> I'm wondering if there are any other gotchas that I should be aware of. >> The list is available at: >> http://hasno.info/2006/12/14/ruby-gotchas-and-caveats >> >> I was considering adding &&= to the list as it's functionality seemed a >> bit odd to me at first. >> --mark >> > > The follow gets on my nerves a bit > > class A > def foo > yield "foo" > end > end > > a = A.new > a.foo do |a| > puts a > end > > a.foo do |a| > puts a > end > > --- > > foo > test.rb:12: undefined method `foo' for "foo":String (NoMethodError) > > --- > > Arguments to blocks are not scoped locally if the > name already exists in the outer scope. I think this > might be changing in Ruby 2.0??? I think so. I believe that I and Guy Decoux are the only people who will miss it :-) David -- Q. What's a good holiday present for the serious Rails developer? A. RUBY FOR RAILS by David A. Black (http://www.manning.com/black) aka The Ruby book for Rails developers! Q. Where can I get Ruby/Rails on-site training, consulting, coaching? A. Ruby Power and Light, LLC (http://www.rubypal.com)