Projects

Ticket #381 (closed defect: fixed)

Opened 2 years ago

Last modified 2 years ago

Losing track of a defined constant - possibly related to Module.autoload

Reported by: kamal.fariz@… Owned by: lsansonetti@…
Priority: minor Milestone: MacRuby 0.5
Component: MacRuby Keywords: autoload require constants
Cc:

Description

There seems to be a bug in the interaction of autoload and requires. I tried hard to reduce this with no success. However, here is the smallest snippet that will illustrate this bug:

$ macruby -rubygems -rrack -r"rack/builder" -e "Rack::Builder"
core:in `require:': uninitialized constant Rack::Builder (NameError)

If you remove the require to "rack/builder", MacRuby will autoload Rack::Builder normally and no exception will be raised.

$ macruby -rubygems -rrack -e "Rack::Builder"

in rack.rb, it defines

autoload :Builder, "rack/builder"

Change History

Changed 2 years ago by lsansonetti@…

Actually, #autoload has not been implemented yet.

Changed 2 years ago by lsansonetti@…

  • status changed from new to closed
  • resolution set to fixed

Should be fixed in r2792.

$ macruby -rubygems -rrack -r"rack/builder" -e "Rack::Builder; p 42"
42
Note: See TracTickets for help on using tickets.