Overloading arithmetic
Frederick Ross
madhadron@gmail.com
Wed Jan 17 11:05:00 GMT 2007
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!
More information about the Kawa
mailing list