This is the mail archive of the
kawa@sourceware.org
mailing list for the Kawa project.
Overloading arithmetic
- From: "Frederick Ross" <madhadron at gmail dot com>
- To: kawa at sources dot redhat dot com
- Date: Wed, 17 Jan 2007 12:05:22 +0100
- Subject: 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!