From: "drbrain (Eric Hodel)" <drbrain@...7.net>
Date: 2012-11-21T04:25:43+09:00
Subject: [ruby-core:49775] [ruby-trunk - Feature #4233] autoload Can't Require Gems


Issue #4233 has been updated by drbrain (Eric Hodel).

Assignee changed from drbrain (Eric Hodel) to nahi (Hiroshi Nakamura)

=begin
If I'm reading load.c correctly, autoload_provided() uses rb_feature_provided() which checks $LOAD_PATH only. This will cause autoload to fail if the gem has not been activated yet.

If autoload's specification only allows autoloading from $LOAD_PATH this is not a bug. The documentation for Kernel#autoload does not say how the file will be loaded, but Module#autoload says:

  Registers filename to be loaded (using Kernel::require) the first
  time that module (which may be a String or a symbol) is accessed
  in the namespace of mod.

Which implies it is a bug.  Perhaps this documentation is wrong.

Since nahi is the autoload expert, I have assigned this back to him.

=end

----------------------------------------
Feature #4233: autoload Can't Require Gems
https://bugs.ruby-lang.org/issues/4233#change-33358

Author: runpaint (Run Paint Run Run)
Status: Assigned
Priority: Normal
Assignee: nahi (Hiroshi Nakamura)
Category: core
Target version: 2.0.0


=begin
 Is it intentional that when used via `autoload`, `require` can't handle Gem names?
 
     run@desktop:~/mir/ruby$  ���  ruby -e 'p require "nokogiri"'
     true
     run@desktop:~/mir/ruby$  ���  ruby -e 'autoload(:N, "nokogiri"); p N'
     -e:1:in `<main>': cannot load such file -- nokogiri (LoadError)
=end



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