>>>>> "R" == Robert Klemme <bob.news / gmx.net> writes:

 Well I must have some problems with english :-)

R> The output would not change even if method <=> was invoked since

 The initial output is

>>>>> "H" == Han Holl <han.holl / prismant.nl> writes:

H> produces, quite against my expectation,
H> Equal
H> I am called

R> a = Awk.new('a')
R> b = Awk.new('a')

R> They *are* equal, although not identical. :-)

 Now I'll try to call <=>

pigeon% cat b.rb
#!/usr/bin/ruby
class Awk < String
   def ==(other)
      (self <=> other) == 0
   end

  def <=>(other)
    puts "I am called"
    super
  end
   
end

a = Awk.new('a')
b = Awk.new('a')
if a == b
  puts 'Equal'
end
if a < b
  puts 'Hurrah'
end
pigeon% 

pigeon% b.rb
I am called
Equal
I am called
pigeon% 

 well, I can see a difference :-))


Guy Decoux