This is the mail archive of the
kawa@sourceware.org
mailing list for the Kawa project.
supporting dynamic/interactive procedure re-definition
- From: Per Bothner <per at bothner dot com>
- To: "kawa at sourceware dot org" <kawa at sourceware dot org>
- Date: Sun, 05 Sep 2010 21:43:39 -0700
- Subject: supporting dynamic/interactive procedure re-definition
On 08/21/2010 02:51 PM, Helmut Eller wrote:
For me, interactive programming includes that it's possible to compile a
file and load the compiled code into the running Lisp. I want to use
the same file, with the same module imports/exports as I would for a
batch compiler. Then I want to make a small fix to the file, compile it
and load it again. And the (existing) bindings should be updated in
some sensible way. Yes, updatable bindings are obviously a problem for
compile-time analysis.
I checked in an experimental fix that should help.
For example, create a file /tmp/foo.scm, containing:
(define (foo) "old")
$ kawa
#|kawa:1|# (require "/tmp/foo.scm")
#|kawa:2|# (define (bar) (foo))
#|kawa:3|# (define baz (list foo))
#|kawa:4|# (bar)
old
#|kawa:5|# ((car baz))
old
Then edit /tmp/foo.scm to:
(define (foo) "new")
and then:
##|kawa:6|# (require "/tmp/foo.scm")
#|kawa:7|# (bar)
new
#|kawa:8|# ((car baz))
new
Note this only handles functions, not variables, and specifically
only functions defined using this form:
(define (NAME PARAMS) BODY)
There are probably other limitations (and bugs); please let me know.
--
--Per Bothner
per@bothner.com http://per.bothner.com/