Project

General

Profile

Actions

Bug #20411

closed

Kenrel.autoload? behaviour

Added by gmcgibbon (Gannon McGibbon) about 1 month ago. Updated about 1 month ago.

Status:
Closed
Assignee:
-
Target version:
-
[ruby-core:117445]

Description

👋 I recently tried checking if a top-level constant was autoloaded within a module, and it doesn't seem to work properly when calling autoload? from Kernel. Here's a simple reproduction script:

autoload :A, "a.rb"

module B
  puts Kernel.autoload?(:A) # nil
  puts Module.autoload?(:A) # a.rb
end

puts Kernel.autoload?(:A) # a.rb
puts Module.autoload?(:A) # a.rb

I would expect Kernel.autoload? and Module.autoload? to behave the same way, and return the path of the autoloaded constant until it is loaded.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0