From: Trans Date: 2005-11-24T15:17:26+09:00 Subject: Re: string range membership > I'm not sure what you meant here. Range has no relation with > sorting. Can you elaborate? #succ defines a sort order of sorts (pun intended ;-). But #<=> defines a sort order too along with comparability. In most classes there's no problem, but in String the two come into conflict --the orders are not the same. Then consider that Range is not a true interval because it uses #succ. This is why I created a true Interval class that uses #+ instead. Likewise Range shouldn't use #<=> either, but another method, lets call it #cmp. This would fix the problem. In general: module Comparable def cmp(o) self<=>o end end That is to say, for anything comparable #cmp is the same as #<=>, unless otherwise defined. (Alternately you could define #cmp as an alias of #<=> directly in the classes it is needed --that would probably be better.) Then in String define #cmp specially to confom to the successive order as defined by #succ. Thus having Range use #cmp instead of #<=> the issue is solved. In summary, an object would then be "Rangeable" if it supports #succ, but only fully so if is also supports #cmp too (instead of #<=>). Does it make sense now? (Sorry if I'm not explaining well, it's a tad subtle and it's been awhile since I worked on it too, so I have been trying to recall it all myself too). T.