From: "gmcgibbon (Gannon McGibbon) via ruby-core" Date: 2024-04-05T23:00:17+00:00 Subject: [ruby-core:117447] [Ruby master Bug#20411] Kenrel.autoload? behaviour Issue #20411 has been updated by gmcgibbon (Gannon McGibbon). Ah, I see. Thank you for clarifying! Strangely, if you use `class B` and not a `module B`, the behaviour changes. Do classes not count as a namespace? I agree the documentation could be improved. I will submit a patch to improve the docs. ---------------------------------------- Bug #20411: Kenrel.autoload? behaviour https://bugs.ruby-lang.org/issues/20411#change-107828 * Author: gmcgibbon (Gannon McGibbon) * Status: Open * ruby -v: 3.3.0 * Backport: 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN ---------------------------------------- ���� 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. -- https://bugs.ruby-lang.org/ ______________________________________________ ruby-core mailing list -- ruby-core@ml.ruby-lang.org To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org ruby-core info -- https://ml.ruby-lang.org/mailman3/postorius/lists/ruby-core.ml.ruby-lang.org/