From: "shioyama (Chris Salzberg)" <noreply@ruby-lang.org>
To: ruby-core@ruby-lang.org
Subject: [ruby-core:110031] [Ruby master Bug#18960] Module#using raises RuntimeError when called at toplevel from wrapped script
Date: Fri, 23 Sep 2022 05:58:58 +0000 (UTC) [thread overview]
Message-ID: <redmine.journal-99282.20220923055858.13031@ruby-lang.org> (raw)
In-Reply-To: redmine.issue-18960.20220809133842.13031@ruby-lang.org
Issue #18960 has been updated by shioyama (Chris Salzberg).
@shugo I've updated my PR and added a spec calling a method which calls `using`, which fails with the previous code but passes with the updated code. Can you have a look?
----------------------------------------
Bug #18960: Module#using raises RuntimeError when called at toplevel from wrapped script
https://bugs.ruby-lang.org/issues/18960#change-99282
* 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/
next prev parent reply other threads:[~2022-09-23 5:59 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-09 13:38 [ruby-core:109456] [Ruby master Bug#18960] Module#using raises RuntimeError when called at toplevel from wrapped script shioyama (Chris Salzberg)
2022-08-09 13:44 ` [ruby-core:109457] " shioyama (Chris Salzberg)
2022-08-22 4:30 ` [ruby-core:109623] " shioyama (Chris Salzberg)
2022-08-22 5:02 ` [ruby-core:109624] " jeremyevans0 (Jeremy Evans)
2022-08-22 6:19 ` [ruby-core:109625] " shugo (Shugo Maeda)
2022-08-22 7:48 ` [ruby-core:109626] " shioyama (Chris Salzberg)
2022-09-22 22:39 ` [ruby-core:110010] " mame (Yusuke Endoh)
2022-09-22 23:41 ` [ruby-core:110017] " shioyama (Chris Salzberg)
2022-09-22 23:55 ` [ruby-core:110019] " shugo (Shugo Maeda)
2022-09-23 1:25 ` [ruby-core:110021] " shioyama (Chris Salzberg)
2022-09-23 1:30 ` [ruby-core:110022] " shioyama (Chris Salzberg)
2022-09-23 1:36 ` [ruby-core:110023] " shioyama (Chris Salzberg)
2022-09-23 2:51 ` [ruby-core:110026] " shugo (Shugo Maeda)
2022-09-23 5:58 ` shioyama (Chris Salzberg) [this message]
2022-09-23 10:28 ` [ruby-core:110043] " shugo (Shugo Maeda)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.ruby-lang.org/en/community/mailing-lists/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=redmine.journal-99282.20220923055858.13031@ruby-lang.org \
--to=ruby-core@ruby-lang.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).