Project

General

Profile

Actions

Feature #12686

closed

Allowing a postposed rescue in a method argument

Added by sonots (Naotoshi Seo) over 7 years ago. Updated over 7 years ago.

Status:
Closed
Assignee:
-
Target version:
-
[ruby-core:76958]

Description

On defining my own DSL, I wanted to write a code like:

foo (Integer(ENV['FOO']) rescue nil)

where foo is a method which receives one argument , but I got following error

SyntaxError: (irb):1: syntax error, unexpected modifier_rescue, expecting ')'

In contrast, following codes were valid:

foo ((Integer(ENV['FOO']) rescue nil))

or

foo (begin; Integer(ENV['FOO']); rescue; nil; end)

This is a feature request to allow such a syntax, a postposed rescue in a method argument.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0