It looks like those were just other numbers being added; Ruby has many
fixnums in it… not just those you are adding!
Those are probably all sorts of fixnums running irb.
Chris
···
----- Original Message -----
From: “Daniel Carrera” dcarrera@math.umd.edu
Newsgroups: comp.lang.ruby
Sent: Saturday, February 08, 2003 4:14 PM
Subject: Help overloading Fixnum#+
Hello,
I’m trying to overload Fixnum#+, but I am getting what seems to be a
recursion (see below). Does anyone know what that happens? Perhaps I
don’t know how “alias” works.
$ cat >test.rb
class Fixnum
alias plus +
def +(other)
puts “hello”
self.plus(other)
end
end
$ irb
require ‘test’
=> true
2+2
hello
hello
hello
hello
hello
hello
hello
hello
hello
hello
hello
hello
hello
hello
hello
hello
hello
hello
hello
hello
hello
=> 4
–
Daniel Carrera
Graduate Teaching Assistant. Math Dept.
University of Maryland. (301) 405-5137