Dave / thomases.com (Dave Thomas) wrote in <m266l6ofsd.fsf / zip.local.thomases.com>: >rpmohn / panix.com (Ross Mohn) writes: >> >> 1) Should nil be allowed as a Hash key? This does not make sense to >> me. 2) Maybe there should be a method defined for nil.<=> ? I think if >> it always returned -1 it would be appropriate. > >Perhaps the alternative questions might be: should you always be able >to sort a hash based on it's keys? I suspect the answer is "no". For >example: > > h = { STDIN => 1, STDOUT => 2 } > > STDIN <=> STDOUT > NameError: undefined method `<=>' for #<IO:0x401900a4> > > >Hash keys need only provide #hash and #eql?. There's no requirement for ><=>, so in general you can't rely on being able to sort a hash. I guess so, but I don't know if I'm convinced yet. Maybe it's just that I'm not used to such a flexible language? Thanks for re-stating the question more correctly -RPM -- Ross Mohn rpmohn / panix.com