From: "Stephan Kämper" Date: 2002-02-25T21:44:00+09:00 Subject: Re: inconsistence in class complex GOTO Kentaro wrote: > > > As far as I see, Complex inherits from Numeric and that's OK. > > And it doesn't include Comparable, which relects the fact that complex > > numbers can'T be compared with '>' and the like. > > I agree halfly. > > In Ruby world, Module forms partialy order, i.e., A < B and B < C > implies A < C for any module A,B,C. Now, we have Complex < Numeric > and Numeric < Comparable, therefore Complex < Comparable automatically > even if Complex#<=> would be undefined. Ooops, you're right. I didn't go deep enough into the the documentation. > There are other Ruby-definable strange numeric sets, e.g., Hamilton's > Quotanion, which has four imaginary units. So, Complex isn't only > special. > > However, undef Complex#<=> and ignoring the fact Complex < Comparable > seems a practical and acceptable option, IMHO. Could be a way to go... > To go rigorous, > Numeric must not include Comparable but Integer, Float and Rational > must include severally. Yes. Happy rubying! Stephan