From: "David A. Black" Date: 2005-09-06T07:56:34+09:00 Subject: Re: Change Binding of a Proc Hi -- On Tue, 6 Sep 2005, Trans wrote: > > Trans wrote: >> Now that seemed like a really smart solution --but when I try it I get >> some really STRANGE behavior. In my code @start is assign to one of the >> procs, so then: >> >> s = @start >> p s >> p s.call >> p machine.instance_eval{ s } >> p machine.instance_eval{ s.call } >> p machine.instance_eval{ s.call.call.call } >> >> returns >> >> # >> # >> # >> # >> # > > er... > > irb(main):001:0> start = 10 > => 10 > irb(main):002:0> start = lambda { start } > => # > irb(main):003:0> start.call > => # That's because your lambda is a closure. It respects the binding of start, which you've (re)bound to the lambda itself. David -- David A. Black dblack@wobblini.net