yarv-dev-en:44
From: SASADA Koichi <ko1 atdot.net>
Date: Tue, 21 Feb 2006 01:30:24 +0900
Subject: [yarv-dev-en:44] Re: instance_eval and local variable scope
Hi, Christian Neukirchen wrote: > ruby 1.9.0 (2006-02-14) [powerpc-darwin7.9.0] > YARVCore 0.3.3 (rev: 453) [opts: ] > /Users/chris/mess/current/ytest.rb:2:in `instance_eval': undefined local variable or method `foo' for "bla":String (NameError) > from (eval):1:in `<main>' > from /Users/chris/mess/current/ytest.rb:2:in `instance_eval' > from /Users/chris/mess/current/ytest.rb:2:in `<main>' > > Is this a bug, a valid 1.9/2.0 change or just some awful stupid and > suprising trick I'd better not exploit? ;-) Valid 2.0 Change :) You should use eval* with binding if you want to save local variables. And another change, Proc can't use as Binding. eval('1', Proc.new{}) #=> wrong argument type YARVCore::VM::Proc (expected Binding) (TypeError) Regards, -- // SASADA Koichi at atdot dot net -- ML: yarv-dev-en quickml.atdot.net Info: http://www.atdot.net/~ko1/quickml
43 2006-02-21 01:00 [chneukirchen gmail.c] instance_eval and local variable scope -> 44 2006-02-21 01:30 ┗[ko1 atdot.net ] 47 2006-02-21 02:35 ┗[surrender_it yahoo.i]