This is the mail archive of the kawa@sourceware.org mailing list for the Kawa project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Overloading arithmetic


Can kawa handle overloading *, +, etc.?  For instance, if I take the
2d-vector class from the docs, then

(define (+ (a :: <2d-vector>) (b :: <2d-vector>)) (a:add b))

Then using it (or (a:add b) as well) promptly fails with:
Argument #1 (1.0) to '+' has wrong type (gnu.math.DFloNum) (gnu.math.DFloNum)

So the simple minded approach isn't right.  Is there a way to make
this work properly?

--
Frederick Ross
Graduate Fellow, (|Siggia> + |McKinney>)/sqrt(2) Lab
The Rockefeller University
Je ne suis pas Fred Cross!


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]