From: Tanaka Akira Date: 2003-05-19T16:32:56+09:00 Subject: Re: ruby-dev summary #20159-20200 In article <3EC868DD.9030904@path.berkeley.edu>, Joel VanderWerf writes: > How about using class.name as a fallback, so that Floats and Integers > get sorted together? > > p [1, "1", 1.5, 2].sort { |x, y| > begin > x <=> y > rescue NoMethodError > x.class.name <=> y.class.name > end > } Do you think y has <=> even if x has no <=> ? This is another reason for why the ordering by object_id is better. However I agree that the ordering by object_id is not intuitive. So it may not Ruby way :-) -- Tanaka Akira