kawa-commonlisp-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Kawa-commonlisp-dev] Java representation of define-class slots


From: Per Bothner
Subject: Re: [Kawa-commonlisp-dev] Java representation of define-class slots
Date: Fri, 21 Jun 2013 21:47:04 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130514 Thunderbird/17.0.6

On 06/21/2013 01:19 AM, John Cowan wrote:
How are slots represented in the instances of define-class classes?
Are they just Java instance variables, or are they more complicated
than that?  Are they copied down from the superclasses, or is there some
other trick to it?

I believe I've written up how Kawa multiple inheritance works -
but I can't find such a write-up, beyond the rather limited:

http://www.gnu.org/software/kawa/Defining-new-classes.html

Especially note the interface: property under "General class properties".

So answer is "they're more compliacted than thaT\\t" - sometimes.

If you specify 'interface: #f' (which is the default with
define-simple-class) then you get simple Java instance variables.

For define-class (assuming interface: isn't specified) we create an
interface where each field compiles to get/set method pair.
In addition we create an implementation class that implements
the get/set methods using a Java field.

If the Scheme class has super-classes, then the generated
interface inherits from the generated interfaces of the super-classes,
but the generated class does not extend the generated classes of
the super-classes.

Thus Kawa support true multiple inheritance.
--
        --Per Bothner
address@hidden   http://per.bothner.com/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]