Bill Atkins wrote:
> Is there any way to cause "", [], and {} to have different behaviors. 
> I'd like to be able to have {} create OrderedHash's instead of Hash's,
> but I don't know how to change this behavior.  If I do Hash =
> OrderedHash, then Hash.new will create an OrderedHash, but {} still
> gives me an old-fashioned hash.  If I do
> 
> def Hash.new *args
>    OrderedHash.new *args
> end
> 
> I get the same results.  Is it possible to override these built-in
> constructors?

I thought of something like this three years ago. It's not possible.
{ x => y } is a Hash no matter what you do.

[] can be redefined, but only as a method.  [1,2,3] will still be a
plain Array.

That help any?


Hal