Actions
Bug #7865
closedA required file is not added to $LOADED_FEATURES until after it has run
Description
=begin
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:
true
true
But it current prints:
false
true
=end
Updated by ko1 (Koichi Sasada) almost 12 years ago
- Category set to core
- Assignee set to matz (Yukihiro Matsumoto)
- Priority changed from Normal to 5
- Target version set to 2.6
Matz issue?
or other can judge it?
This behavior is same as 1.9.3 or before. So it is not a compatibility issue.
Updated by nobu (Nobuyoshi Nakada) almost 12 years ago
- Status changed from Open to Closed
- Priority changed from 5 to Normal
=begin
It's an intended behavior, not a bug.
When an exception raised while loading, the feature won't be added to
(({$LOADED_FEATURES})).
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})).
=end
Actions
Like0
Like0Like0