David Alan Black <dblack / candle.superlink.net> writes:

> What about a to_h method for arrays?  I mention this mainly for the
> sake of symmetry with other to_* methods.  Then again, such a method
> may violate some principle of design: it does seem slightly wrong for
> Array to "know" how to generate a hash (whereas not strange for Hash
> to know how to create itself from an array).

That was my thinking (if you can call it that ;-) It seems reasonable
for a more complex class to know about a more primitive one, but not
the other way around.

An alternative might be  Kernel::Hash, along the lines of
Kernel::Integer, which does the business depending on the type of its
argument.


Regards


Dave