Projects

Ticket #619 (closed defect: fixed)

Opened 2 years ago

Last modified 10 months ago

Constant scope in a block is determined at run-time?

Reported by: chekenan@… Owned by: lsansonetti@…
Priority: major Milestone: MacRuby 0.11
Component: MacRuby Keywords: #reduction
Cc:

Description

r3572

Following code can't run by macruby. Both ruby 1.8.7 and 1.9.1 work.

module A
  B = "Not defined in top-level."

  def self.extended(base)
    base.class_eval do
      puts B
    end
  end 
end

class C
  # Not include A
  extend A
end

NameError: uninitialized constant C::B

from /Users/dche/(irb):6:in `block' from /Users/dche/(irb):5:in `extended:'

Change History

Changed 2 years ago by rebotfc@…

I get this problem as well, could it be related to:  https://www.macruby.org/trac/ticket/626

Changed 14 months ago by eloy.de.enige@…

  • keywords #reduction added
  • milestone set to MacRuby 1.0

I'm setting the milestone to 1.0, as my assumption is that const lookup should work good for 1.0. Correct me if I'm wrong, though.

Changed 10 months ago by lsansonetti@…

  • status changed from new to closed
  • resolution set to fixed
  • milestone changed from MacRuby 1.0 to MacRuby 0.11

Should be fixed in master.

Note: See TracTickets for help on using tickets.