This was an excellent suggestion but only covers half of the issue:

print "nil <=> nil:     #{nil <=> nil}\n"	# works great
print "nil <=> 'test':  #{nil <=> 'test'}\n"	# works great
print "nil <=> 1:       #{nil <=> 1}\n"		# works great
print "'test' <=> nil:  #{'test' <=> nil}\n"	# fails
print "1 <=> nil:       #{1 <=> nil}\n"		# fails


-----Original Message-----
From:	Michael Neumann [SMTP:neumann / s-direktnet.de]
Sent:	Wednesday, July 18, 2001 1:55 PM
To:	ruby-talk ML
Subject:	[ruby-talk:18065] Re: <=> and nil values

Michael Davis wrote:
> Hello everyone,
> 
> I would like to request a change to the <=> method to support the 
> following:
> 
> 	Nil <=> 1  	== -1
> 	1 <=> nil 	== 1
> 	nil <=> nil 	== 0
> 	nil <=> 'test' 	== -1
> 	'test' <=> nil 	== 1
> 

To change 
  nil <=> any Object
is no problem. Just write:

class NilClass

  def <=>( anObject )
    anObject ? -1 : 0
  end

end

nil <=> nil     # => 0
nil <=> 'test'  # => -1
nil <=> 1       # => -1

But the other way round is not that easy, because you have to 
change all <=> methods of Ruby's classes.

Regards,

  Michael


-- 
Michael Neumann
merlin.zwo InfoDesign GmbH
http://www.merlin-zwo.de