From: Jakub Travnik Date: 2002-06-12T20:21:46+09:00 Subject: Re: Trick or Bug? Nikodemus Siivola wrote: > All this talk of block local variables reminded me of a funny trick... > > As you know, receivers in ruby cannot change their class? No become, etc. > Right? > > Wrong: > > #!/usr/bin/env ruby > a = proc { a = 1 } > puts "a is a #{a.class}" > a.call > puts "a is a #{a.class}" > no, it does change only one variable, not object variable is pointing to source: ----------------------------- def test(a) puts "a is a #{a.class}" a.call puts "a is a #{a.class}" end a = proc { a = 1 } test a ----------------------------- output: ----------------------------- a is a Proc a is a Proc ----------------------------- Jakub Travnik jabber://jtra@jabber.com