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

Per Bothner per@bothner.com
Mon May 12 07:02:00 GMT 2008


The last few days I've done some work on modules and dependencies.
Things seems to work better now - please try again with the current
SVN source.

Ethan Herdrick wrote:
> I'm not seeing that behavior.  For one thing, I'm getting the (require
> "foo.scm") usage to work from within a servlet.  But if that file,
> "foo.scm" contains a (require "bar.scm"), I can't get that second
> require to work.

It seems to work now, at least for me.

> What should "bar.scm" be?  An absolute path, like
> "/usr/tomcat/webapps/someapp/ROOT/WEB-INF/classes/bar.scm"?  Or a path
> relative to the calling file's path?

I guess the former will work, but the latter is of course recommended.

> I've tried absolute and relative
> paths and only the absolute paths are working for calls to require
> from within servlets, but as I mention above, nothing is working for
> me when calling from a static module file.

I haven't tried a "static module file", but this works:

adder.scm:

(require 'http)
(require "result.scm")
(define (num-parameter name default)
   (string->number (request-parameter name default)))

(define sum1 (num-parameter 'sum1 0))
(define sum2 (num-parameter 'sum2 1))

(html:html
  (html:head (html:title "Accumulating adder"))

  (html:body
   (html:form method:'POST
    (html:table
     (html:tr

      (html:td (result-so-far))
      (html:td
       (html:input
        name: 'sum1
        value: (+ sum1 sum2))))
     (html:tr
      (html:td "Add to it:")
      (html:td
       (html:input name: 'sum2 value: sum2))))
    (html:input type:"submit" value:"Submit"))))

result.scm:

(define (result-so-far)
   "The result so far is: ")

If I modify the "The result so far is: " then that
get reflected when I reload adder.scm.

It also works if I rename "adder.scm" to plain "adder",
as long as the file starts with:

;; This is -*- scheme -*-

As you suggest, there may also be some Windows-specific
problems - I've only tested this on GNU/Linux.  But first
see if the changes I made have helped.
-- 
	--Per Bothner
per@bothner.com   http://per.bothner.com/



More information about the Kawa mailing list