From: Martin DeMello Date: 2010-10-07T04:53:32+09:00 Subject: Re: setting local variables in a binding On Thu, Oct 7, 2010 at 12:38 AM, John Sikora wrote: > Hmmm, it seems to work when x is already defined (in 1.9.2): > > irb(main):001:0> x=4 > => 4 > irb(main):002:0> b=binding > => # > irb(main):003:0> eval("x=5", b) > => 5 > irb(main):004:0> x > => 5 > irb(main):005:0> > > If I do not set x to a value beforehand, I get the same error. Do not > know why though. Oddly enough, if x is defined beforehand you don't even need the binding: ruby-1.9.2-p0 > x = 5 => 5 ruby-1.9.2-p0 > eval "x = 42" => 42 ruby-1.9.2-p0 > x => 42 martin