From: Gavin Sinclair Date: 2002-11-20T12:56:52+09:00 Subject: Re: Defining <=> From: "Yukihiro Matsumoto" > Hi, > > In message "Defining <=>" > on 02/11/20, "Tim Hunter" writes: > > |I need to define <=> in a class. What is the appropriate thing to do when > |the "other" argument is not an object in the class? For example, comparing > |myObject <=> nil, which actually happens in the debugger. Should I just > |send it to the superclass? > > Return nil. > > matz. If you return nil, then future operations like < and sort will raise the following error (1.6.5 Cygwin): TypeError: no implicit conversion from nil This is a bit cryptic. Is there any benefit to *not* just raising a TypeError yourself (with a more relevant message) in the definition of <=> ? Gavin