[ruby-core:109624] [Ruby master Bug#18960] Module#using raises RuntimeError when called at toplevel from wrapped script
From:
"jeremyevans0 (Jeremy Evans)" <noreply@...>
Date:
2022-08-22 05:02:46 UTC
List:
ruby-core #109624
Issue #18960 has been updated by jeremyevans0 (Jeremy Evans). shioyama (Chris Salzberg) wrote in #note-3: > @jeremyevans0 You [most recently contributed to the `wrap` option](https://bugs.ruby-lang.org/issues/6210), what do you think about this? Am I correct to consider this a bug, and [this](https://github.com/ruby/ruby/pull/6226) the correct fix? I'm not sure whether this is a bug, but since `using` is permitted at top-;evel and also permitted in a module definition, it seems logical it should work at top-level with an implicit top-level module. The pull request looks correct to me. Not sure if the spec should use `ruby_bug`, I would just use `ruby_version_is`. ---------------------------------------- Bug #18960: Module#using raises RuntimeError when called at toplevel from wrapped script https://bugs.ruby-lang.org/issues/18960#change-98809 * Author: shioyama (Chris Salzberg) * Status: Open * Priority: Normal * ruby -v: 3.1.2p20 * Backport: 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN ---------------------------------------- I noticed that this file works when loaded with `load`, but fails if you pass `true` (or a module) as the `wrap` argument. ```ruby # using.rb using Module.new ``` This works: ```ruby load "./using.rb" ``` This doesn't: ```ruby load "./using.rb", true # raises RuntimeError (main.using is permitted only at toplevel) ``` I believe the latter should work. -- 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>