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]

Re: Conforming to base classes [KAWA]


Chris <chrisb@nimrod.itg.telstra.com.au> writes:

> I don't understand how to write a Kawa module that conforms to a Java
> base class. Like let's say I want to override hashCode from Object.
> hashCode returns an int. I can't just go...
> 
> (define (hashCode) 1)

You should be able to do:

(define (hashCode) <int> 1)

or

(define (hashCode) :: <int> 1)

(The latter is very new but I think cleaner syntax.)

You also have to use

(module-static #f)

or use an explicit (module-extends ...) to prevent the
method from being static.
-- 
	--Per Bothner
per@bothner.com   http://www.bothner.com/~per/

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