From: "dunric (David Unric)" Date: 2013-04-09T17:10:11+09:00 Subject: [ruby-core:54135] [ruby-trunk - Bug #8239] Inline rescue bug Issue #8239 has been updated by dunric (David Unric). Hanmac (Hans Mackowiak) wrote: > its because its parsed as > (bar, baz = foo) rescue [3,4] > i try > bar, baz = (foo rescue [3,4]) > and this works I think this explanation is not valid. Let's see on an example: bar = foo rescue [3,4] If it would be parsed as you've described it would be equivalent to (bar = foo) rescue [3,4] but in contrary the assignment is performed ! ie. bar == [3,4] now. I did pointed out the issue concerns the case of *multiple* assignment expression. ---------------------------------------- Bug #8239: Inline rescue bug https://bugs.ruby-lang.org/issues/8239#change-38387 Author: dunric (David Unric) Status: Open Priority: Normal Assignee: matz (Yukihiro Matsumoto) Category: syntax Target version: ruby -v: 2.0.0p0 There is a possible bug in parsing of inline rescue. When an inline rescue is a part of multiple assignment and exception is raised, the assignment is silently ignored. def foo raise "error" end bar, baz = 1,2 # bar == 1, baz == 2 bar, baz = foo rescue [3,4] # no assignment performed: bar == 1, baz == 2 # expected after the expression: bar == 3, baz == 4 Already discussed at stackoverflow.com: http://stackoverflow.com/questions/15880136/exceptions-why-does-adding-parenthesis-change-anything -- http://bugs.ruby-lang.org/