Bug #7865

A required file is not added to $LOADED_FEATURES until after it has run

Added by Charlie Somerville about 1 year ago. Updated about 1 year ago.

Assignee:Yukihiro Matsumoto
Target version:next minor
ruby -v:ruby 2.0.0dev (2013-02-08 trunk 39161) [x86_64-darwin11.4.0] Backport:


Required files are not added to $LOADED_FEATURES until after they have been executed.

This is easily demonstrated with two files, a.rb and b.rb:

# a.rb
require "./b"
p $LOADED_FEATURES.grep(/b.rb/).any?

# b.rb
p $LOADED_FEATURES.grep(/b.rb/).any?

Running (({a.rb})) should print:


But it current prints:



#1 Updated by Koichi Sasada about 1 year ago

  • Category set to core
  • Assignee set to Yukihiro Matsumoto
  • Priority changed from Normal to High
  • Target version set to next minor

Matz issue?
or other can judge it?

This behavior is same as 1.9.3 or before. So it is not a compatibility issue.

#2 Updated by Nobuyoshi Nakada about 1 year ago

  • Status changed from Open to Closed
  • Priority changed from High to Normal

It's an intended behavior, not a bug.
When an exception raised while loading, the feature won't be added to
And, it hasn't been loaded yet, has it?

If you want to know what features are now getting loaded, you should
suppose new feature, e.g. (({$LOADING_FEATURES})).

Also available in: Atom PDF