From: tom.enebo@gmail.com
To: ruby-core@ruby-lang.org
Subject: [ruby-core:95090] [Ruby master Bug#16181] return from a proc in a module/class body returns out of script. Should be LJE.
Date: Wed, 25 Sep 2019 18:05:52 +0000 (UTC) [thread overview]
Message-ID: <redmine.issue-16181.20190925180551.4f09715537943cfe@ruby-lang.org> (raw)
In-Reply-To: redmine.issue-16181.20190925180551@ruby-lang.org
Issue #16181 has been reported by enebo (Thomas Enebo).
----------------------------------------
Bug #16181: return from a proc in a module/class body returns out of script. Should be LJE.
https://bugs.ruby-lang.org/issues/16181
* Author: enebo (Thomas Enebo)
* Status: Open
* Priority: Normal
* Assignee:
* Target version:
* ruby -v:
* Backport: 2.5: UNKNOWN, 2.6: UNKNOWN
----------------------------------------
return is not allowed from class/module body. But if we insert a return into a block then we can invoke the block then it returns all the way out of the script. This has to be accidental behavior doesn't it? I believe the case below should end up as a LocalJumpError:
```
class Foo
proc { return }.call
end
puts "NEVER SEEN"
```
This behavior started some time in 2.5 (it used to be an LJE).
--
https://bugs.ruby-lang.org/
next parent reply other threads:[~2019-09-25 18:06 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <redmine.issue-16181.20190925180551@ruby-lang.org>
2019-09-25 18:05 ` tom.enebo [this message]
2019-09-27 23:00 ` [ruby-core:95138] [Ruby master Bug#16181] return from a proc in a module/class body returns out of script. Should be LJE merch-redmine
2019-09-30 18:21 ` [ruby-core:95155] " tom.enebo
2019-09-30 18:32 ` [ruby-core:95156] " merch-redmine
2019-09-30 20:11 ` [ruby-core:95159] " tom.enebo
2019-09-30 23:13 ` [ruby-core:95162] " merch-redmine
2019-10-01 15:03 ` [ruby-core:95174] " tom.enebo
2019-10-02 15:14 ` [ruby-core:95190] " merch-redmine
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.issue-16181.20190925180551.4f09715537943cfe@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).