This is the mail archive of the kawa@sources.redhat.com 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]

Re: How to define constructors for classes defined using define-simple-class


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/


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