This is the mail archive of the
kawa@sources.redhat.com
mailing list for the Kawa project.
Re: How to define constructors for classes defined using define-simple-class
- From: Per Bothner <per at bothner dot com>
- To: S D <s dot mailinglists at gmail dot com>
- Cc: kawa at sources dot redhat dot com
- Date: Tue, 05 Apr 2005 00:11:53 -0700
- Subject: Re: How to define constructors for classes defined using define-simple-class
- References: <301e20f60503272330482cff2c@mail.gmail.com> <4247B59C.7070003@bothner.com> <301e20f605033015403c775034@mail.gmail.com> <424B3D0C.1070901@bothner.com> <301e20f605040423592c6817bc@mail.gmail.com>
S D wrote:
The following code
(define-simple-class overloading-test ()
((test a :: <int>) :: <int>
(test (this) a a))
((test a :: <int>
b :: <int>) :: <int>
(+ a b)))
gives me
class1.scm:4:2: call to 'test' has too many arguments (3; must be 2)
In http://www.gnu.org/software/kawa/Defining-new-classes.html:
define-simple-class name (supers ...) field-or-method-decl ...
...
The scope of the body of a method includes the field-decls of the
object. It does include the surrounding lexical scope. It sort-of
also includes the declared methods, but this is not working yet.
It would be nice to get it working, but ...
Note that the following does work:
(define-simple-class overloading-test ()
((test a :: <int>) :: <int>
(invoke (this) 'test a a)) ;; ***
((test a :: <int>
b :: <int>) :: <int>
(+ a b)))
--
--Per Bothner
per@bothner.com http://per.bothner.com/