https://bugs.ruby-lang.org/https://bugs.ruby-lang.org/favicon.ico?17113305112011-04-07T13:47:20ZRuby Issue Tracking SystemRuby master - Bug #4561: 1.9.2 requires parentheses around argument of method call in an array, where 1.8.7 did nothttps://bugs.ruby-lang.org/issues/4561?journal_id=163022011-04-07T13:47:20Zdschweisguth (Dave Schweisguth)dave@schweisguth.org
<ul></ul><p>=begin<br>
Same thing with pre formatting:</p>
<p>[dave hladik:~] cat method_call_without_parens_in_array.rb<br>
def method_name(arg)<br>
end</p>
<p>[ method_name 'value' ]<br>
[dave hladik:~] rvm system<br>
[dave hladik:~] ruby -v<br>
ruby 1.8.7 (2011-02-18 patchlevel 334) [i686-darwin10]<br>
[dave hladik:~] ruby method_call_without_parens_in_array.rb<br>
[dave hladik:~] rvm 1.9.2<br>
[dave hladik:~] ruby -v<br>
ruby 1.9.2p180 (2011-02-18 revision 30909) [x86_64-darwin10.7.0]<br>
[dave hladik:~] ruby method_call_without_parens_in_array.rb<br>
method_call_without_parens_in_array.rb:4: syntax error, unexpected tSTRING_BEG, expecting keyword_do or '{' or '('<br>
[ method_name 'value' ]<br>
^<br>
method_call_without_parens_in_array.rb:4: syntax error, unexpected ']', expecting $end<br>
[dave hladik:~] cat method_call_with_parens_in_array.rb<br>
def method_name(arg)<br>
end</p>
<p>[ method_name('value') ]<br>
[dave hladik:~] rvm system<br>
[dave hladik:~] ruby -v<br>
ruby 1.8.7 (2011-02-18 patchlevel 334) [i686-darwin10]<br>
[dave hladik:~] ruby method_call_with_parens_in_array.rb<br>
[dave hladik:~] rvm 1.9.2<br>
[dave hladik:~] ruby method_call_with_parens_in_array.rb</p>
<a name="no-error"></a>
<h1 >no error<a href="#no-error" class="wiki-anchor">¶</a></h1>
<p>=end</p> Ruby master - Bug #4561: 1.9.2 requires parentheses around argument of method call in an array, where 1.8.7 did nothttps://bugs.ruby-lang.org/issues/4561?journal_id=163032011-04-07T15:27:23Znaruse (Yui NARUSE)naruse@airemix.jp
<ul><li><strong>Status</strong> changed from <i>Open</i> to <i>Assigned</i></li><li><strong>Assignee</strong> set to <i>matz (Yukihiro Matsumoto)</i></li></ul><p>=begin</p>
<p>=end</p> Ruby master - Bug #4561: 1.9.2 requires parentheses around argument of method call in an array, where 1.8.7 did nothttps://bugs.ruby-lang.org/issues/4561?journal_id=163052011-04-08T01:09:52ZEregon (Benoit Daloze)
<ul></ul><p>=begin<br>
That has bitten me a few times too, but I accepted it as it is probably clearer in a long expression.</p>
<p>I'm curious to see why this changed.<br>
=end</p> Ruby master - Bug #4561: 1.9.2 requires parentheses around argument of method call in an array, where 1.8.7 did nothttps://bugs.ruby-lang.org/issues/4561?journal_id=177502011-06-11T15:58:33Zko1 (Koichi Sasada)
<ul></ul><p>Matz, could you reply?</p> Ruby master - Bug #4561: 1.9.2 requires parentheses around argument of method call in an array, where 1.8.7 did nothttps://bugs.ruby-lang.org/issues/4561?journal_id=178102011-06-11T22:53:08Zmatz (Yukihiro Matsumoto)matz@ruby.or.jp
<ul><li><strong>ruby -v</strong> changed from <i>ruby 1.9.2p180 (2011-02-18 revision 30909) [x86_64-darwin10.7.0]</i> to <i>-</i></li></ul><p>Hi,</p>
<p>In message "Re: <a href="/issues/4561">[ruby-core:36994]</a> [Ruby 1.9 - Bug <a class="issue tracker-1 status-5 priority-4 priority-default closed" title="Bug: 1.9.2 requires parentheses around argument of method call in an array, where 1.8.7 did not (Closed)" href="https://bugs.ruby-lang.org/issues/4561">#4561</a>] 1.9.2 requires parentheses around argument of method call in an array, where 1.8.7 did not"<br>
on Sat, 11 Jun 2011 15:58:33 +0900, Koichi Sasada <a href="mailto:redmine@ruby-lang.org" class="email">redmine@ruby-lang.org</a> writes:</p>
<p>|Bug <a class="issue tracker-1 status-5 priority-4 priority-default closed" title="Bug: 1.9.2 requires parentheses around argument of method call in an array, where 1.8.7 did not (Closed)" href="https://bugs.ruby-lang.org/issues/4561">#4561</a>: 1.9.2 requires parentheses around argument of method call in an array, where 1.8.7 did not<br>
|<a href="http://redmine.ruby-lang.org/issues/4561" class="external">http://redmine.ruby-lang.org/issues/4561</a><br>
|<br>
|Matz, could you reply?</p>
<p>It's an intentional syntax change in 1.9.</p>
<pre><code> matz.
</code></pre> Ruby master - Bug #4561: 1.9.2 requires parentheses around argument of method call in an array, where 1.8.7 did nothttps://bugs.ruby-lang.org/issues/4561?journal_id=180412011-06-17T09:48:30Zjlnr (Julian Raschke)julian@raschke.de
<ul></ul><p>Yukihiro Matsumoto wrote:</p>
<blockquote>
<p>It's an intentional syntax change in 1.9.</p>
</blockquote>
<p>I have run into the same issue today and wasn't sure if it was a bug or intentional. Nice to find both this issue and your recent response.</p>
<p>Out of curiosity, what is the reasoning behind this change? It seems a bit unintuitive that foo(bar 5) and {bar 5} work, even [bar { baz }], but [bar 5] not. All four are enclosed calls without parenthesis. Is there an ambiguity nearby that this syntax change is trying to clarify?</p> Ruby master - Bug #4561: 1.9.2 requires parentheses around argument of method call in an array, where 1.8.7 did nothttps://bugs.ruby-lang.org/issues/4561?journal_id=184642011-06-26T19:02:30Znahi (Hiroshi Nakamura)nakahiro@gmail.com
<ul><li><strong>Assignee</strong> changed from <i>matz (Yukihiro Matsumoto)</i> to <i>ko1 (Koichi Sasada)</i></li><li><strong>Target version</strong> set to <i>1.9.3</i></li></ul> Ruby master - Bug #4561: 1.9.2 requires parentheses around argument of method call in an array, where 1.8.7 did nothttps://bugs.ruby-lang.org/issues/4561?journal_id=184952011-06-26T19:49:51Zko1 (Koichi Sasada)
<ul><li><strong>Status</strong> changed from <i>Assigned</i> to <i>Closed</i></li></ul>