https://redmine.ruby-lang.org/https://redmine.ruby-lang.org/favicon.ico?17113305112015-06-08T21:15:20ZRuby Issue Tracking SystemRuby master - Bug #11236: inconsistent behavior using ** vs hash as method parameterhttps://redmine.ruby-lang.org/issues/11236?journal_id=527972015-06-08T21:15:20Zjeremyevans0 (Jeremy Evans)merch-redmine@jeremyevans.net
<ul></ul><p>This is expected behavior, keyword argument hashes only support symbol keys, not hash keys. I suppose the error message could be better, though.</p> Ruby master - Bug #11236: inconsistent behavior using ** vs hash as method parameterhttps://redmine.ruby-lang.org/issues/11236?journal_id=528032015-06-09T07:39:36Znobu (Nobuyoshi Nakada)nobu@ruby-lang.org
<ul><li><strong>Description</strong> updated (<a title="View differences" href="/journals/52803/diff?detail_id=38060">diff</a>)</li></ul><p>What message would be better?</p> Ruby master - Bug #11236: inconsistent behavior using ** vs hash as method parameterhttps://redmine.ruby-lang.org/issues/11236?journal_id=528052015-06-09T08:25:43Zakostadinov (Aleksandar Kostadinov)akostadinov@gmail.com
<ul></ul><p>Nobuyoshi Nakada wrote:</p>
<blockquote>
<p>What message would be better?</p>
</blockquote>
<p>Unsupported key type?</p>
<p>btw what is the reason to have that limitation? Not that I need this functionality, I just happened to notice the difference...</p> Ruby master - Bug #11236: inconsistent behavior using ** vs hash as method parameterhttps://redmine.ruby-lang.org/issues/11236?journal_id=683912017-12-14T07:24:09Zhsbt (Hiroshi SHIBATA)hsbt@ruby-lang.org
<ul><li><strong>Related to</strong> <i><a class="issue tracker-2 status-5 priority-4 priority-default closed" href="/issues/14183">Feature #14183</a>: "Real" keyword argument</i> added</li></ul> Ruby master - Bug #11236: inconsistent behavior using ** vs hash as method parameterhttps://redmine.ruby-lang.org/issues/11236?journal_id=739082018-09-05T16:11:45Zmarcandre (Marc-Andre Lafortune)marcandre-ruby-core@marc-andre.ca
<ul></ul><p>When last argument is hash-like but has keys that are not symbols, we could output instead "wrong number of arguments (2 for 1); note that the last argument has keys that are not symbols and thus was not considered as keyword parameters"</p> Ruby master - Bug #11236: inconsistent behavior using ** vs hash as method parameterhttps://redmine.ruby-lang.org/issues/11236?journal_id=812982019-08-30T21:39:02Zjeremyevans0 (Jeremy Evans)merch-redmine@jeremyevans.net
<ul><li><strong>Status</strong> changed from <i>Open</i> to <i>Closed</i></li></ul><p>With the the changes in <a class="issue tracker-2 status-5 priority-4 priority-default closed" title="Feature: "Real" keyword argument (Closed)" href="https://redmine.ruby-lang.org/issues/14183">#14183</a>, keyword splats can support arbitrary keys, and the second example now passes:</p>
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="nb">test</span><span class="p">(</span><span class="ss">:ads</span><span class="p">,</span> <span class="ss">:d</span> <span class="o">=></span> <span class="mi">6</span><span class="p">,</span> <span class="ss">:f</span> <span class="o">=></span> <span class="ss">:gah</span><span class="p">,</span> <span class="p">{</span><span class="n">a</span><span class="p">:</span><span class="mi">3</span><span class="p">,</span><span class="n">b</span><span class="p">:</span><span class="mi">4</span><span class="p">}</span> <span class="o">=></span> <span class="mi">3</span><span class="p">)</span>
<span class="c1"># ads</span>
<span class="c1"># {:d=>6, :f=>:gah, {:a=>3, :b=>4}=>3}</span>
</code></pre>