On Aug 22, 2006, at 6:22 AM, Pedro Cộte-Real wrote:
> A lot of people seem to want this so why not create a standard OHash?
> A nice syntax like the [1=>2] one would be great as well.

This syntax is already valid but with a different meaning:

class A
   def [](arg)
     arg
   end
end

p A.new[1]	# 1
p A.new[1=>2]	# {1 => 2}  (a hash instance)


The [1=>2] syntax is a method call in disguise.  Not sure what
ambiguities might be hidden in trying to interpret that as a method
call in some places and as an ordered hash literal in others.


Gary Wright