I discovered this after playing around with object ids.
ObjectSpace._id2ref(2648)
=> :**
ObjectSpace._id2ref(6688)
=> :**
ObjectSpace._id2ref(2648) == ObjectSpace._id2ref(6688)
=> false
The first one is the symbol for the exponentiation operator;
2.send(ObjectSpace._id2ref(2648), 3)
=> 8
2.send(ObjectSpace._id2ref(6688), 3)
NoMethodError: undefined method `**' for 2:Fixnum
But the second one somehow isn't? I assume they just look the same after being passed to #print. But what is the difference? Is one of them somehow a unicode symbol?
UPDATE: The second one is probably the new double splat for keyword arguments, but I can't seem to verify this.
pry -v
I getPry version 0.9.12.6 on Ruby 2.0.0
. – Samboid = ':**'.object_id; puts ObjectSpace._id2ref(id)
is suggestive so why not check the class of the_id2ref
return values? – IdentificationRangeError: 0x00000000001a20 is not symbol id value
, so that number seems to fit in the possible range for symbol objects. – Mitosis10000.times{ |n| ObjectSpace._id2ref(n).inspect }
. – SamboObjectSpace._id2ref(6688).to_s.codepoints
? It could be some odd character, possibly U+2217: ASTERISK OPERATOR (which is 8727 in decimal). – Apathy[42, 42]
. Very mysterious... – Samboobject_id
2648 and 6728 on my machine. – Apathy**
to indicate an options hash in an arguments list. I can’t reproduce the issue on 1.9.3. It looks like there is an extra ‘hidden’**
symbol that doesn’t appear in the symbol table but can be found by looking at ObjectSpace. – Apathy