Details

    • Type: Bug Bug
    • Status: Resolved Resolved
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: JRuby 1.6
    • Fix Version/s: JRuby 1.7.0.RC1
    • Component/s: Interpreter
    • Labels:
      None
    • Environment:
      OSX 10.6.7, JRuby 1.6.0 (via rvm) in --1.9 mode
    • Number of attachments :
      1

      Description

      When I run the attached script in --1.9 mode it raises a NameError exception. However when I run it using --1.8, or with mri 1.8.7/1.9.2/rubinius no exception is raised.

        Activity

        Hide
        Diego Plentz added a comment -

        Still valid in 1.6.3

        Show
        Diego Plentz added a comment - Still valid in 1.6.3
        Hide
        Thomas E Enebo added a comment -

        Very basic problem with constant resolution in top-level scope. Embarrasing Marking for 1.7

        Show
        Thomas E Enebo added a comment - Very basic problem with constant resolution in top-level scope. Embarrasing Marking for 1.7
        Hide
        Charles Oliver Nutter added a comment -

        On master, this fails the same in both 1.8 and 1.9 mode, compiled or interpreted. Something basic about toplevel include + const lookup is failing us here.

        Investigating.

        Show
        Charles Oliver Nutter added a comment - On master, this fails the same in both 1.8 and 1.9 mode, compiled or interpreted. Something basic about toplevel include + const lookup is failing us here. Investigating.
        Hide
        Charles Oliver Nutter added a comment -

        Interestingly, accessing just "Generator" works fine. So it seems to be something wrong with how colon2 (Generator::Literal) is working.

        Show
        Charles Oliver Nutter added a comment - Interestingly, accessing just "Generator" works fine. So it seems to be something wrong with how colon2 (Generator::Literal) is working.
        Hide
        Charles Oliver Nutter added a comment -

        LOL.

        So the actual problem here is that we define a top-level Generator class to support Enumerator#next, regardless of whether generator.rb has been required. We're not incorrectly failing to find the Literal constant...we're correctly finding our Generator instead of yours.

        If I require 'generator' in Ruby 1.8, it fails exactly the same way. That library does not exist in 1.9.

        I guess this is a good time to consider namespacing our always-present Generator class out of toplevel.

        Show
        Charles Oliver Nutter added a comment - LOL. So the actual problem here is that we define a top-level Generator class to support Enumerator#next, regardless of whether generator.rb has been required. We're not incorrectly failing to find the Literal constant...we're correctly finding our Generator instead of yours. If I require 'generator' in Ruby 1.8, it fails exactly the same way. That library does not exist in 1.9. I guess this is a good time to consider namespacing our always-present Generator class out of toplevel.
        Hide
        Charles Oliver Nutter added a comment -

        Forgot to resolve this.

        commit 05aa55457433554900e7d3369796cd5e5f2d0db8
        Author: Charles Oliver Nutter <headius@headius.com>
        Date:   Fri Sep 7 15:22:45 2012 -0500
        
            Fix JRUBY-5674: Difference in include behaviour in --1.9 mode
            
            The problem was not actually a difference in include behavior;
            the issue was that we were always defining a top-level Generator
            class that interfered with the lookup of the user's library's
            Generator class. Moved Generator to JRuby::Generator to avoid the
            namespace pollution.
        
        :000000 100644 0000000... ad5ac9c... A	src/jruby/kernel/jruby/generator.rb
        
        Show
        Charles Oliver Nutter added a comment - Forgot to resolve this. commit 05aa55457433554900e7d3369796cd5e5f2d0db8 Author: Charles Oliver Nutter <headius@headius.com> Date: Fri Sep 7 15:22:45 2012 -0500 Fix JRUBY-5674: Difference in include behaviour in --1.9 mode The problem was not actually a difference in include behavior; the issue was that we were always defining a top-level Generator class that interfered with the lookup of the user's library's Generator class. Moved Generator to JRuby::Generator to avoid the namespace pollution. :000000 100644 0000000... ad5ac9c... A src/jruby/kernel/jruby/generator.rb

          People

          • Assignee:
            Charles Oliver Nutter
            Reporter:
            Dan Kubb
          • Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: