This is the mail archive of the kawa@sourceware.org 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: "Image-based development" with Kawa


Thank you very much for the quick reply!

> Kawa 1.8 is "very old" rather than "stable", I'm afraid.  (I'll put
> a 1.8.90 beta out very soon, I hope.)

I am now using the latest Kawa from SVN.

> The latest (SVN) Kawa does support some improvements.  Particularly,
> you can:
>    (require "file-name")
> and it automatically compile sit, as a module, and recompiles if it has
> changed.  It updates the global environment. (However, there is no
> support for updating existing values -such as if an existing value
> references an updated function - but that could be added.)  The goal is
> to make compilation more automatic.

This is interesting. However, my system does not have the concept of a
"source file" per se. Would it be possible to implement a "compile"
macro/procedure, which would take a list of expressions and compile them
as if they where contained in a source file passed to "compile-file"?

> Make sure <my-class> "references" the enclosing module, so it gets
> serialized.  You can probably do that by serializing its ClassLoader,
> which is an ArrayClassLoader (see below).

Can you give me a hint on how to get hold on this ArrayClassLoader when
the class has been defined in a read-eval-print loop (where all
interaction with my system actually takes place, I am not using
"compile-file" at all, at this point in time)?

Sorry if this is a stupid question to ask, but it might help my
understanding a lot if you could comment on the following behavior I
observe in a Kawa read-eval-print loop. I am using the <2d-vector> class
from the Kawa docs (which has some methods defined):

#> (define-simple-class <2d-vector> () [...])
-> undefined

#> (*:getMethods <2d-vector>)
-> #!null ;; no methods defined?

#> (*:scale (*:add (make <2d-vector>) (make <2d-vector>)) 1.0)
-> $N2d$Mnvector@992bae

#> (*:getMethods <2d-vector>)
-> $N2d$Mnvector.add($N2d$Mnvector)$N2d$Mnvector

#> (*:getClassLoader (*:getClass <2d-vector>))
-> sun.misc.Launcher$AppClassLoader@133056f ;; an AppClassLoader, not an
ArrayClassLoader?

I learned from your "Kawa internals" paper that "non-simple" forms, like
class-definitions, passed to a read-eval-print loop are in fact wrapped
into a ModuleBody which gets rewritten into a ModuleExp. This is then
compiled to bytecodes forming a Runnable class. In the case of a
class-definition, the interactively defined class would be represented
as an inner class of this Runnable class. If I understand you correctly,
the bytecodes are then loaded via an ArrayClassLoader and the Runnable
class is run. The solution to my problem then would be to get hold of
this ArrayClassLoader and serialize it together with the ClassType
object representing the interactively defined class. When de-serializing
the class, I would have to de-serialize the associated ArrayClassLoader
and register it as a parent of the current ClassLoader.

Could this work? If so, it would be possible to allow "image-based"
development in Kawa/Scheme, which would be a very important feature for
the domain I am working in.


Best regards,

Oliver



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