Details

    • Type: Bug Bug
    • Status: Resolved Resolved
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: JRuby 1.7.0.pre2
    • Component/s: None
    • Labels:
      None
    • Number of attachments :
      0

      Description

      Using /home/conrad/.rvm/gems/ruby-1.9.3-p194
      def Object.foo; class_eval("binding").eval("_method_"); end
      Object.foo
      => :foo

      Using /home/conrad/.rvm/gems/jruby-1.6.7
      def Object.foo; class_eval("binding").eval("_method_"); end
      Object.foo
      => :class_eval

        Activity

        Hide
        Charles Oliver Nutter added a comment -

        For some reason this doesn't feel like a high-priority item. Did this affect something real or did you just stumble upon it?

        Show
        Charles Oliver Nutter added a comment - For some reason this doesn't feel like a high-priority item. Did this affect something real or did you just stumble upon it?
        Hide
        Conrad Irwin added a comment -

        Hi Charles,

        Certainly not important at all, but it was causing pry some test failures. (http://travis-ci.org/#!/pry/pry/jobs/1725998)

        We use the name of the binding to determine how to treat commands like "show-source". If you're inside a binding (binding.pry) we show you the source of the method; if you're inside a module (YARD.pry) we show you the source of the module.

        I've fixed this in pry too: https://github.com/pry/pry/commit/d57f229c053732c9062ff3de080ab35dafd440ce.

        Conrad

        Show
        Conrad Irwin added a comment - Hi Charles, Certainly not important at all, but it was causing pry some test failures. ( http://travis-ci.org/#!/pry/pry/jobs/1725998 ) We use the name of the binding to determine how to treat commands like "show-source". If you're inside a binding (binding.pry) we show you the source of the method; if you're inside a module (YARD.pry) we show you the source of the module. I've fixed this in pry too: https://github.com/pry/pry/commit/d57f229c053732c9062ff3de080ab35dafd440ce . Conrad
        Hide
        Uwe Kubosch added a comment -

        Will it affect stack traces? In that case it is rather important to make development with JRuby easier.

        Show
        Uwe Kubosch added a comment - Will it affect stack traces? In that case it is rather important to make development with JRuby easier.
        Hide
        Charles Oliver Nutter added a comment -

        JRuby generates stack traces for evaluated bindings based on the place they're actually called anyway, so that's already a minor divergence.

        Looks like it's limited to class_eval, so it may be trivial:

        system ~/projects/jruby $ jruby -e "def Object.foo; eval('binding').eval('__method__'); end; p Object.foo"
        :foo
        
        system ~/projects/jruby $ jruby -e "def Object.foo; class_eval('binding').eval('__method__'); end; p Object.foo"
        :class_eval
        
        Show
        Charles Oliver Nutter added a comment - JRuby generates stack traces for evaluated bindings based on the place they're actually called anyway, so that's already a minor divergence. Looks like it's limited to class_eval, so it may be trivial: system ~/projects/jruby $ jruby -e "def Object.foo; eval('binding').eval('__method__'); end; p Object.foo" :foo system ~/projects/jruby $ jruby -e "def Object.foo; class_eval('binding').eval('__method__'); end; p Object.foo" :class_eval
        Hide
        Charles Oliver Nutter added a comment -
        commit cc6e09f4b3e83964fb2603fb9aec23e1718d4e4d
        Author: Charles Oliver Nutter <headius@headius.com>
        Date:   Tue Jul 3 10:50:03 2012 -0500
        
            Fix JRUBY-6753
            
            class_eval should inherit __name__ from the caller
            
            class_eval/module_eval were still being framed, which caused them
            to interfere with getting the actual caller name. Removed the
            framing and the bug is fixed.
        
        :100644 100644 22aa412... bd18837... M	src/org/jruby/RubyModule.java
        
        Show
        Charles Oliver Nutter added a comment - commit cc6e09f4b3e83964fb2603fb9aec23e1718d4e4d Author: Charles Oliver Nutter <headius@headius.com> Date: Tue Jul 3 10:50:03 2012 -0500 Fix JRUBY-6753 class_eval should inherit __name__ from the caller class_eval/module_eval were still being framed, which caused them to interfere with getting the actual caller name. Removed the framing and the bug is fixed. :100644 100644 22aa412... bd18837... M src/org/jruby/RubyModule.java

          People

          • Assignee:
            Charles Oliver Nutter
            Reporter:
            Conrad Irwin
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: