[ruby-core:94946] [Ruby master Bug#16169] rescue in a method argument
From:
daniel@...42.com
Date:
2019-09-17 16:09:50 UTC
List:
ruby-core #94946
Issue #16169 has been updated by Dan0042 (Daniel DeLorme). This is the same thing as #16092, where I submitted a documentation patch a little while ago. ---------------------------------------- Bug #16169: rescue in a method argument https://bugs.ruby-lang.org/issues/16169#change-81562 * Author: zverok (Victor Shepelev) * Status: Open * Priority: Normal * Assignee: * Target version: * ruby -v: * Backport: 2.5: UNKNOWN, 2.6: UNKNOWN ---------------------------------------- At 2.4, #12686 was introduced, allowing code like this: ```ruby foo (Integer(ENV['FOO']) rescue nil) ``` Though, I noticed that in current Ruby correctness of this syntax depends on space after the method name: ```ruby foo (Integer(ENV['FOO']) rescue nil) # => OK foo(Integer(ENV['FOO']) rescue nil) # SyntaxError ((irb):4: syntax error, unexpected modifier_rescue, expecting ')') # foo(Integer(ENV['FOO']) rescue nil) # ^~~~~~ ``` I wonder, whether it is just a bug or a parser limitation (I can't guess which ambiguity the space-less version produces, but I could be missing something)?.. -- 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>