Hi --

On Thu, 21 Dec 2006, bradphelan wrote:

>
>
> On 20 Dec, 18:01, dbl... / wobblini.net wrote:
>> 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
>
> For what reasons will you miss it? I am sure Matz had it that way for a
> reason and I don't
> claim to be enlightened enough to say it is wrong. Tt just doesn't fit
> with the way I would
> expect it to work. Locally scoped seems more natural.

I don't really have a reason.  It just never bothered me, and it
always made sense to me.  So I've never felt a need for it to be
changed.  But, as I say, I'm in the minority.


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)