Re: SISCweb questions

"Nikita Sidorov" <[email protected]> Mon, 10 Mar 2008 00:12:05 +0200
Newsgroups gmane.comp.java.sisc.user
Message-ID <[email protected]>
Hi!

I think class-path-extension-append! is meant not to load/change/reload  
code but to work with static code like jar files. To reload modified code  
you should try something like this:

;; it will return  
file:/Users/mago/progs/apache-tomcat-6.0.14/webapps/pruebas/WEB-INF/scm/
(define home (string-append "file://"  
(@siscweb/context::context/get-real-path "/") "WEB-INF/scm"))

(load (string-append home "/examples/test.scm"))
(import examples/test) ;; if needed

You might also want to load compiled code and recompile it when the source  
has been changed. To do it you may take a look at my loader.scm that I  
once posted on this mailing-list (the discussion:  
http://sourceforge.net/mailarchive/forum.php?thread_name=46E50006.5010901%40mail.ru&forum_name=sisc-users  
the attachment:  
http://sourceforge.net/mailarchive/attachment.php?list_name=sisc-users&message_id=46E658AA.4060104%40mail.ru&counter=1  
)

If you use the loader then it will look like this:

(define home (string-append "file://"  
(@siscweb/context::context/get-real-path "/") "WEB-INF/scm"))
;; You should put loader.scm into your WEB-INF/scm directory
(load (string-append home "/loader.scm")
(import loader)
(add-load-path home) ;; you may add several more source dirs in this way

;; to load examples/test use this
(require "examples/test")

If there is no examples/test.scc file or it is older then  
examples/test.scm then the source file will be compiled (and loaded),  
otherwise the compiled file will be loaded.

Regards,
Nikita

> Hi,
>
> I'm interested in using SISCweb for a project. Besides the
> continuations style of web programming I'm also interested in being
> able to prototype code and test it without having to restart Tomcat.
> But I haven't been able to understand how I should do it.
> When I use telnet to connect to the REPL I try to do something line this:
>
> (class-path-extension-append! '("WEB-INF/scm/"))
> (require-extension (lib examples/test))
>
> And it responds:
> Error: library examples/test not found
>
> I discovered that it is appending "WEB-INF/scm/" to what my current
> directory was when I started Tomcat, instead of using the webapp's
> main directory. As a workaround I can do:
>
> (class-path-extension-append!
> '("file:/Users/mago/progs/apache-tomcat-6.0.14/webapps/pruebas/WEB-INF/scm/"))
>
> And now, require-extension works.
>
> But then I have another problem. This will work only the first time I
> want to load the library and import the module. Afterwards, as SISC
> knows it has already loaded that library and imported the module, I
> can't load the file again to test the changes. How should I do this?
>
> Thank you,
>



-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/