On Wednesday 12 June 2002 01:02 pm, Hal E. Fulton wrote: > ----- Original Message ----- > From: "Nikodemus Siivola" <tsiivola / cc.hut.fi> > To: "ruby-talk ML" <ruby-talk / ruby-lang.org> > Sent: Wednesday, June 12, 2002 5:26 AM > Subject: Trick or Bug? > > > 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}" > > Clever, but not correct, I think. > You've just pointed 'a' to a > different object, not changed the > class of the original object. > > As I understand 'become' in Smalltalk > (and I don't really) doesn't it > operate on an object? I never used it. But if I remember correctly it changes ALL references to the old object to a new object. > > Hal Fulton