https://bugs.ruby-lang.org/https://bugs.ruby-lang.org/favicon.ico?17113305112016-12-04T18:27:32ZRuby Issue Tracking SystemRuby master - Bug #13005: Inline rescue is inconsistent when rescuing NoMethodErrorhttps://bugs.ruby-lang.org/issues/13005?journal_id=618682016-12-04T18:27:32Zmatz (Yukihiro Matsumoto)matz@ruby.or.jp
<ul><li><strong>Status</strong> changed from <i>Open</i> to <i>Closed</i></li></ul><pre><code>o.a = 1 rescue $!.class
</code></pre>
<p>is parsed as</p>
<pre><code>o.a = (1 rescue $!.class)
</code></pre>
<p>Try</p>
<pre><code>(o.a = 1) rescue $1.class
</code></pre>
<p>Matz.</p> Ruby master - Bug #13005: Inline rescue is inconsistent when rescuing NoMethodErrorhttps://bugs.ruby-lang.org/issues/13005?journal_id=618892016-12-06T07:28:16Zduerst (Martin Dürst)duerst@it.aoyama.ac.jp
<ul><li><strong>Status</strong> changed from <i>Closed</i> to <i>Open</i></li><li><strong>Assignee</strong> set to <i>matz (Yukihiro Matsumoto)</i></li></ul><p><a class="user active user-mention" href="https://bugs.ruby-lang.org/users/13">@matz (Yukihiro Matsumoto)</a>: Is there a good reason that <code>o.a = 1 rescue $!.class</code> is interpreted as <code>o.a = (1 rescue $1.class)</code>, while it looks to me as if <code>o.a = 1 if $!.class</code> is <code>(o.a = 1) if $!.class</code>?</p>
<p>(Backwards compatibility might be a reasonable good reason, but I can't imagine it being useful.)</p> Ruby master - Bug #13005: Inline rescue is inconsistent when rescuing NoMethodErrorhttps://bugs.ruby-lang.org/issues/13005?journal_id=619052016-12-07T00:09:40Zshyouhei (Shyouhei Urabe)shyouhei@ruby-lang.org
<ul></ul><p>Martin Dürst wrote:</p>
<blockquote>
<p><a class="user active user-mention" href="https://bugs.ruby-lang.org/users/13">@matz (Yukihiro Matsumoto)</a>: Is there a good reason that <code>o.a = 1 rescue $!.class</code> is interpreted as <code>o.a = (1 rescue $1.class)</code>, while it looks to me as if <code>o.a = 1 if $!.class</code> is <code>(o.a = 1) if $!.class</code>?</p>
<p>(Backwards compatibility might be a reasonable good reason, but I can't imagine it being useful.)</p>
</blockquote>
<p>I guess issue <a class="issue tracker-1 status-5 priority-4 priority-default closed" title="Bug: Inline rescue behavior inconsistent for method calls with arguments and assignment (Closed)" href="https://bugs.ruby-lang.org/issues/12402">#12402</a> is the reason behind this behaviour.</p> Ruby master - Bug #13005: Inline rescue is inconsistent when rescuing NoMethodErrorhttps://bugs.ruby-lang.org/issues/13005?journal_id=619062016-12-07T00:10:10Zshyouhei (Shyouhei Urabe)shyouhei@ruby-lang.org
<ul><li><strong>Related to</strong> <i><a class="issue tracker-1 status-5 priority-4 priority-default closed" href="/issues/12402">Bug #12402</a>: Inline rescue behavior inconsistent for method calls with arguments and assignment</i> added</li></ul> Ruby master - Bug #13005: Inline rescue is inconsistent when rescuing NoMethodErrorhttps://bugs.ruby-lang.org/issues/13005?journal_id=800392019-07-25T20:58:07Zjeremyevans0 (Jeremy Evans)merch-redmine@jeremyevans.net
<ul><li><strong>Status</strong> changed from <i>Open</i> to <i>Closed</i></li></ul>