Project

General

Profile

Actions

Bug #14062

closed

Top-level return allows an argument

Added by Eregon (Benoit Daloze) over 6 years ago. Updated over 4 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 2.5.0dev (2017-10-26 trunk 60450) [x86_64-linux]
[ruby-core:83590]

Description

puts "Here"
return 42 # or :foo, or any value
ruby test.rb
Here

Should it be a SyntaxError, as mentioned in https://bugs.ruby-lang.org/issues/4840#note-24 ?
It seems confusing to accept it silently, as one could expect the exit code to be affected by it (that should not be the case imho).

Discovered in https://github.com/ruby/spec/pull/530


Files

top-level-return-warn-argument.patch (1.32 KB) top-level-return-warn-argument.patch jeremyevans0 (Jeremy Evans), 07/26/2019 10:15 PM

Related issues 1 (0 open1 closed)

Related to Ruby master - Feature #4840: Allow returning from requireClosednobu (Nobuyoshi Nakada)Actions
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0