Object.send(:eval, "self") returns caller instead of Object
-----------------------------------------------------------

                 Key: JRUBY-5211
                 URL: http://jira.codehaus.org/browse/JRUBY-5211
             Project: JRuby
          Issue Type: Bug
          Components: Core Classes/Modules
    Affects Versions: JRuby 1.5.5
         Environment: java version "1.6.0_22", OSX 10.6.5
            Reporter: Marc Slemko
            Priority: Minor


When you do a send to eval on an object (either Object or any subclass I tried) 
then the eval executes in the context of the caller, not the class in question. 
 

I found this issue in some internal code we were porting to jruby, was easy to 
work around in this case but is an incompatibility.

On jruby:

Marcs-Mac.local:~$ jruby -v
jruby 1.5.5 (ruby 1.8.7 patchlevel 249) (2010-11-10 4bd4200) (Java HotSpot(TM) 
64-Bit Server VM 1.6.0_22) [x86_64-java]
Marcs-Mac.local:~$ jruby -S irb
irb(main):001:0> Object.send(:eval, "self")
=> main

On MRI:

irb(main):002:0> Marcs-Mac.local:~$ ruby -v
ruby 1.8.7 (2009-06-12 patchlevel 174) [universal-darwin10.0]
Marcs-Mac.local:~$ irb
>> Object.send(:eval, "self")
=> Object


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to