Actions
Feature #12138
closedSupport `Kernel#load_with_env(filename, cbase: SomeMod, cref: someMod, binding: SomeMod) # => obj`
Feature #12138:
Support `Kernel#load_with_env(filename, cbase: SomeMod, cref: someMod, binding: SomeMod) # => obj`
Status:
Feedback
Assignee:
-
Target version:
-
Description
Ruby's require and load methods currently only return true, which means that any code being loaded must affect the global namespace, or have the global namespace affected for it to interact with.
This means that to load data, like a gemspec, you have to read the file in and eval it:
To load a plugin or configuration, you have to modify a global object:
- Railties hook into subclassing
- RSpec tests have to be declared to a global object
- Minitest, too
- Rake extends main to store results on a global object
It's why gems have to be built the way they do, to avoid colliding with other code in the global namespace (fwiw, I've seen a computer segfault when the person unwittingly write their own Queue class). Which is also why we can't load multiple versions of a gem in the same namespace.
Actions