From: Ara.T.Howard@... Date: 2004-09-07T03:15:10+09:00 Subject: Re: OK... :) question about hash and array literals On Mon, 6 Sep 2004, Hal Fulton wrote: > 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. database apis may use hashes as tuples so you end up comparing them. this is also a can where a = tuples.first b = tuples.last a[field] = b[field] cmp = a == b may, or may not, require the notion of insertion order. -a -- =============================================================================== | EMAIL :: Ara [dot] T [dot] Howard [at] noaa [dot] gov | PHONE :: 303.497.6469 | A flower falls, even though we love it; | and a weed grows, even though we do not love it. | --Dogen ===============================================================================