This is the mail archive of the
kawa@sources.redhat.com
mailing list for the Kawa project.
how to define constructor methods in Scheme?
- From: Chris Dean <Chris dot Dean at sokitomi dot com>
- To: "Hoehle, Joerg-Cyril" <Joerg-Cyril dot Hoehle at t-systems dot com>
- Cc: kawa at sources dot redhat dot com
- Date: Mon, 17 Nov 2003 11:34:03 -0800
- Subject: how to define constructor methods in Scheme?
- References: <9F8582E37B2EE5498E76392AEDDCD3FE08086ED5@G8PQD.blf01.telekom.de>
> I haven't found a way to define several or even a single constructor
> for a module written in Kawa.
If you mean that constructors aren't supported for define-simple-class,
then you're right. You can simulate this by have a class <Foo> and
several normal functions (not methods) that create new <Foo>s with the
correct state: make-foo, make-foo-with-thing, etc... Just call these
functions instead of the normal (make <Foo>) form.
On the other hand, if you are trying to use module semantics to map to
Java classes (or OOP in general), I don't believe that is the right way
to think about Kawa modules.
Regards,
Chris Dean