yarv-dev-en:43
From: Christian Neukirchen <chneukirchen gmail.com>
Date: Mon, 20 Feb 2006 17:00:26 +0100
Subject: [yarv-dev-en:43] instance_eval and local variable scope
While trying to port my insanely evil template engine over to YARV, I
stumbled over this:
"quux".instance_eval("foo=42")
p "baar".instance_eval("foo")
Resulting in:
ruby 1.6.8 (2002-12-24) [powerpc-darwin7.0]
42
ruby 1.8.4 (2005-12-24) [powerpc-darwin7.9.0]
42
ruby 1.9.0 (2005-12-17) [i386-mingw32] (thanks to riffraff)
42
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? ;-)
--
Christian Neukirchen <chneukirchen gmail.com> http://chneukirchen.org
--
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]