[#76442] [Ruby trunk Feature#11741] Migrate Ruby to Git from Subversion — naruse@...
Issue #11741 has been updated by Yui NARUSE.
3 messages
2016/07/19
[#76515] [Ruby trunk Bug#12610] webrick: protect from httpoxy — nagachika00@...
Issue #12610 has been updated by Tomoyuki Chikanaga.
3 messages
2016/07/22
[ruby-core:76412] [Ruby trunk Feature#12138][Feedback] Support `Kernel#load_with_env(filename, cbase: SomeMod, cref: someMod, binding: SomeMod) # => obj`
From:
matz@...
Date:
2016-07-19 06:09:05 UTC
List:
ruby-core #76412
Issue #12138 has been updated by Yukihiro Matsumoto. Status changed from Open to Feedback I understand the need for load() with context, but this proposal has * a bad name, "env" is ambiguous * the proposed context (cbase, cref, binding) is not proven sufficient So you (or someone) have to improve the proposal. Matz. ---------------------------------------- Feature #12138: Support `Kernel#load_with_env(filename, cbase: SomeMod, cref: someMod, binding: SomeMod) # => obj` https://bugs.ruby-lang.org/issues/12138#change-59652 * Author: Josh Cheek * Status: Feedback * Priority: Normal * Assignee: ---------------------------------------- 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: * [Rubygems](https://github.com/ruby/ruby/blob/0534b970bc83814e77ea4bd8ba9b2d31fefc9b1e/lib/rubygems/specification.rb#L1164) * [Bundler](https://github.com/bundler/bundler/blob/5e2e2ff089af4875c54b27cfb5d4286471dff125/lib/bundler.rb#L395) To load a plugin or configuration, you have to modify a global object: * [Railties](https://github.com/rails/rails/blob/e2f08a1c0a9d1dc2f27d1dfcd3c9937f4190554a/railties/lib/rails/engine.rb#L356-#L358) hook into subclassing * [RSpec](https://github.com/rspec/rspec-core/blob/f54edeed49799042b8fffddb278466fb7185314e/lib/rspec/core/dsl.rb#L37-L47) tests have to be declared to a global object * [Minitest](https://github.com/seattlerb/minitest/blob/baf6010053279f75f561f6a599d8837151327588/lib/minitest.rb#L262-L265), too * [Rake](https://github.com/ruby/rake/blob/7c9014e5559e846e9ffee1cf1584c4454374dd70/lib/rake/dsl_definition.rb#L194) extends main to store results on a [global object](https://github.com/ruby/rake/blob/7c9014e5559e846e9ffee1cf1584c4454374dd70/lib/rake/dsl_definition.rb#L58-#L60) 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. -- https://bugs.ruby-lang.org/ Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe> <http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>