From: Logan Capaldo Date: 2006-08-09T21:22:39+09:00 Subject: Re: why doesn't Array include Comparable On Aug 9, 2006, at 12:56 AM, Hal Fulton wrote: > ara.t.howard@noaa.gov wrote: >> why __wouldn't__ one want this? >> harp:~ > cat a.rb >> a = 0,1,2 >> b = 2,3,4 >> p a < b rescue puts "can't do that!" >> class Array; include Comparable; end >> p a < b >> harp:~ > ruby a.rb >> can't do that! >> true >> ?? > > Offhand I would guess it's because arrays can > hold arbitrary objects. > > If one array held four different classes of > objects, and another held yet another four > classes of objects, that's potentially sixteen > spaceship operators that would need to be > defined for this to make sense. And most of > those would not make sense anyway. > But spaceship is already defined for array (and it does the right thing (tm)). If Array is going to make spaceship available, why _not_ include Comparable? > > Hal >