From: matz@... (Yukihiro Matsumoto) Date: 2001-08-02T03:28:46+09:00 Subject: [ruby-talk:18988] Re: "Bang" versions of numerical methods on non-immediate values [was: Numbers classes.. Rational number? ] Hi, In message "[ruby-talk:18977] "Bang" versions of numerical methods on non-immediate values [was: Numbers classes.. Rational number? ]" on 01/08/02, Kent Dahl writes: |Summary: I want methods add!, sub!, div! and mul! for all numeric |objects. immediate values (fixnums and symbols) cannot be modified from method, so you cannot implement any bang method for fixnums. You need assignment to alter value in a variable. You want | a = b = 1 | a.add!(1) # a==2 and b==1, due to immediate values but since 1 is a fixnum, thus the value of a cannot be changed. Considering this fact and that fixnums are most common numeric, bang method for numeric is not a good idea. matz.