From: Hal Fulton Date: 2004-09-06T15:01:55+09:00 Subject: Re: OK... :) question about hash and array literals Martin DeMello wrote: > Yukihiro Matsumoto wrote: > >>Hmm, I thought hash order would be ignored always for compares. >>Optional use of order is an interesting idea, although I want better >>looking API than >> >>| {1=>2, 3=>4}.ordered != {3=>4, 1=>2}.ordered > > > How about { 1=>2, 3=>4 } !~ { 3=>4, 1=>2 } > { 1=>2, 3=>4 } =~ { 1=>2, 3=>4 } > > OTOH, that syntax might more profitably be reserved for pattern > matching, which would also be a nice thing to have. I am not especially worried about testing equality with or without order. In nearly five years of Ruby, I cannot recall ever comparing two hashes for equality at all. But if I could have guaranteed order in hash literals and insertion order preserved in general, I would be very happy. More than half the code I have written would benefit from that in some small way (including where I use YAML). Hal