Issue #11140 has been updated by Jeremy Evans.


Considering #5653, should we be making any changes to autoload to make it easier to use, if the intention is to remove it in ruby 3.0?  I think before any improvements to autoload should be considered, we first need a firm decision from Matz on autoload's future in ruby.

If Matz decides that autoload will stay in ruby, I'm definitely in favor of autoload calling Kernel::require.  But if autoload will be removed in ruby 3.0, I don't think we should make changes like this that would make autoload easier to use.  That encourages people to use autoload, which will make updating to ruby 3.0 more painful when the time comes.

----------------------------------------
Feature #11140: Allow rubygems' `require` to handle `autoload` calls
https://bugs.ruby-lang.org/issues/11140#change-52383

* Author: Aaron Patterson
* Status: Open
* Priority: Normal
* Assignee: 
----------------------------------------
Right now, rubygems can't handle calls to `autoload` because `autoload` will directly call `rb_require_safe` rather than sending to `Kernel::require`.

For example:

~~~
class A
  autoload :B, 'a/b' # this is in a different Gem
end
A::B
~~~

The above code won't work because 'a/b' is in a different gem.  I'd like to give rubygems the opportunity to handle requires made through `autoload`.

I've attached a patch that makes the change.


---Files--------------------------------
call_send_on_autoload.diff (1.31 KB)


-- 
https://bugs.ruby-lang.org/