This is the mail archive of the
kawa@sourceware.org
mailing list for the Kawa project.
Re: "Image-based development" with Kawa
- From: Per Bothner <per at bothner dot com>
- To: Oliver Flasch <oliver dot flasch at cs dot uni-dortmund dot de>
- Cc: kawa at sourceware dot org
- Date: Fri, 06 Oct 2006 14:38:24 -0700
- Subject: Re: "Image-based development" with Kawa
- References: <1160169220.13785.58.camel@localhost>
Oliver Flasch wrote:
I am currently building "Katakana", a "rapid application development"
environment for statistical analysis and computational intelligence on
top of Kawa 1.8 (stable).
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.)
While my results are really encouraging so far, I would like to support
a more dynamic, "image-based" or "Smalltalk-like" development style that
does not rely on an "edit-compile-run-cycle".
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.
I'm using XStream
(xstream.codehaus.org) to serialize objects in the scheme environment
and later de-serialize them, which works beautifully except for class
types:
(define-simple-class <my-class> [...])
(serialize-to-file <my-class> "MyClass.img")
The <my-class> class is not stand-alone. It depends on the module it
is defined in. For example, literals get compiled into the module,
and shared between class and functions in that module.
My plan is to use (*:write-to-stream <my-class> [...]) to create the
byte-code for <my-class> so I can bundle it with my ".img" file and
point the class loader to it when <my-class> is de-serialized again.
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).
My
problem is that I do not understand the mechanics of the Kawa compiler
yet, specifically when and why a class defined via "define-simple-class"
or "define-class" gets compiled to bytecode. I found out that a class so
defined seems to be compiled on first use,
No. It is *loaded* on first use. However, the entire module is loaded
eagerly, at once.
If the module is is read/loaded/required from a source file (rather
than being pre-compiled with the kawa -C flag), then the module will
be managed by an ArrayClassLoader.
--
--Per Bothner
per@bothner.com http://per.bothner.com/