From: cardoso_tiago@...
Date: 2016-01-18T14:51:10+00:00
Subject: [ruby-core:72904] [Ruby trunk - Bug #12002] [Open] **param notation seems to be creating a new hash in ruby 2.2.0

Issue #12002 has been reported by Tiago Cardoso.

----------------------------------------
Bug #12002: **param notation seems to be creating a new hash in ruby 2.2.0
https://bugs.ruby-lang.org/issues/12002

* Author: Tiago Cardoso
* Status: Open
* Priority: Normal
* Assignee: 
* ruby -v: 
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN
----------------------------------------
I found the regression regarding the handling of the ** notation for options hash in a method. In ruby 2.1 and lower, it seems to always be handled in the same way, i.e. it is always the same object:

<pre>
def hashie1(o={})
  puts o.object_id
end
def hashie2(**o)
  puts o.object_id
end

v={}
puts v.object_id
hashie1(v)
hashie2(v)

# 2.0.0
69830362391800
69830362391800
69830362391800

# 2.1.6 
69884363736320
69884363736320
69884363736320

# 2.2.4
69922787909840
69922787909840
69922787909700

# 2.3.0
69915134419200
69915134419200
69915134419000
</pre>

I didn't find any documentation regarding this change. Is it supposed to work the way it works in 2.2 and 2.3? Because my understanding was that ** was supposed to be the new notation and should just work as the previous notation. 



-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>