From: Florian Frank Date: 2002-08-06T19:03:43+09:00 Subject: Re: Writing a method that's added to both Fixnum and Bignum On Tue, 2002-08-06 at 10:46, Harry Ohlsen wrote: > There HAS to be a better way to do it, but I just can't think of it. > > Effectively, what I would have thought it should be is something like ... > > class Bignum > def fred > # Do the calculation on self > end > end > > class Fixnum > # Coerce self into a Bignum, say "b" and then return b.fred > end > > But I can't think of how I would coerce the Fixnum into a Bignum. Using a mixin would be a much cleaner possibility: module Fred def fred end end class Bignum include Fred end class Fixnum include Fred end -- ((lambda (~) ((lambda ($) ($ "")) (~ "Florian Frank")) ((lambda (%) (% "B7E9A99D")) (~ "my pgp public key id:"))) (lambda (&) (lambda ({) (display (string-append & " " { "\n")))))