Getting rid of the "edit-compile-run-cycle" for Kawa

Per Bothner per@bothner.com
Sat May 3 16:22:00 GMT 2008


Ethan Herdrick wrote:
> Hi -
> 
> We really want to improve our dev environment for our Kawa web app.
> The main problem is the "edit-compile-run-cycle".  Even though Kawa is
> a great language, this style of development makes it feel like we are
> just using Java.  It slows us down.  What I want is to change some
> function defined in a static module and simply refresh any page in our
> app that uses that function and see the result of the change.

Have you tried this:
http://www.gnu.org/software/kawa/server/auto-servlet.html

[One of the problems I need to fix with Kawa is that finding
documentation isn't always easy.  This particular file is an example
of that ...]

I haven't tested this recently, but hopefully it still works.
Please let me know.  I also have some further serlvet-related
patches from various past experiments - these need to be re-tested
and integrated.

> In trying to achieve this I've made a simple macro "require/smart"
> that will expand to (require <foo>) if the system is in production
> mode, and expand to (load "\some-path\foo.scm") if in development
> mode.  Of course, our existing code behaves somewhat differently when
> loaded instead of required.  I've been working through this but I'm
> not sure what the ultimate result will be.  I might be overlooking
> some fatal flaw in this plan.  This technique does work fine in a very
> simple proof of concept with a very simple tree of dependencies made
> up of three simple files of definitions.

I always discourage use of load.

> In an old post to this list (found here:
> http://www.sourceware.org/ml/kawa/2006-q4/msg00002.html )  Per wrote:
> 
> "...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.)"
> 
> That would be fantastic.  What would need to be done to add that?

It should work now - though I just found a bug ...

> Could it understand dependencies, i.e. recompile a class if a class it
> depends on has been recompiled?

It does that, if you replace "class" by "module": A module A requires B,
and B requires C, the way it is supposed to happen is this:
If a module A requires A, it will make a dependent of B and C.
Next time the require is "executed", then the dependence of B and C
is checked.  If C is modified, this will before B to be recompiled,
which will force A to be recompiled.

Or something like that - I haven't looked at it in a while.
-- 
	--Per Bothner
per@bothner.com   http://per.bothner.com/



More information about the Kawa mailing list