On Wed, 08 Dec 2004 22:30:08 +0900, Glenn Parker wrote:

> Jonathan Paisley wrote:

>> Hash.zipnew ... I quite like the similarity to Hash.new, and the inclusion
>> of the already familiar zip idea is also a good thing. 
> 
> Why does it need a new name?  Instead, why not extend Hash.new to do 
> this when it is passed two arrays?  It seems pretty natural to me, and I 
> don't see any conflict with existing usage.

That's certainly a possibility. I suppose the disadvantage of this is that 
the semantics would then be quite different between one and two arguments:

 1 argument  : specify the default value
 2 arguments : populate the hash with pairings of keys and values

I think it would be more natural to extend the existing Hash[] method, if
that didn't cause a conflict with the existing usage. The question, then,
is whether you'd ever want to construct a hash with just one entry, whose
key and value are arrays.

  h = Hash[keys,values]

I suppose if you did want the one-entry-hash, you could always do:

  h = Hash[key=>value]
or even just
  h = { key=>value }