Project

General

Profile

Actions

Bug #19779

open

`eval "return"` at top level raises `LocalJumpError`

Added by andrykonchin (Andrew Konchin) 4 months ago. Updated about 1 month ago.

Status:
Open
Priority:
Normal
Assignee:
-
Target version:
-
[ruby-core:114251]

Description

Wondering whether it's intentional behaviour. It seems it's the only difference I've noticed between calling return with and without eval:

ruby -e 'return'
ruby -e 'eval "return"'
(eval):1:in `<main>': unexpected return (LocalJumpError)
	from -e:1:in `eval'
	from -e:1:in `<main>'
Actions #1

Updated by andrykonchin (Andrew Konchin) 4 months ago

  • ruby -v set to 3.2.1

Updated by matz (Yukihiro Matsumoto) 3 months ago

Since we allow top-level return (from 2.4), it is nice to allow this too. But to be frank, it is low priority.

Matz.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like1