Re: modules and sisc-initial-environment

Norman Gray <[email protected]> Thu, 1 Feb 2007 15:08:18 +0000
Newsgroups gmane.comp.java.sisc.user
Message-ID <[email protected]>
Scott, hello.

On 2007 Feb 1 , at 14.31, Scott G. Miller wrote:

> Given the code you've posted, it seems that require-library may be
> importing the code into the wrong environment.  If you execute the
> eval-list code, does module m appear in the toplevel environment
> instead?

Yes, it appears so.  The (require-library 'm) within the eval-list  
makes module 'm' available for import at the top-level.  See below.

Aha!

All the best,

Norman




% cat m.scm
(module m
     (mval)
   (define mval 1))
% CLASSPATH=$PWD sisc
SISC (1.16.0-alpha)
#;> (import m)
Error: import from unknown module m
---------------------------
To enable more detailed stack tracing, set the dynamic parameter max- 
stack-trace-depth to a non-zero value, e.g. 16.
---------------------------
Some stack trace entries may have been suppressed. To see all entries  
set the dynamic parameter suppressed-stack-trace-source-kinds to '().
#;> (define (eval-list el)
   (let ((env (sisc-initial-environment)))
     (let loop ((l el))
       (or (null? l)
           (let ()
             (eval (car l) env)
             (loop (cdr l)))))))
#;> (eval-list '((require-library 'm)
              (import m)
              (display mval)
              (newline)))
Error: import from unknown module m
console:7:13: <indeterminate call>
#;> mval
Error: undefined variable 'mval'.
#;> (import m)
#;> mval
1
#;>



-- 
------------------------------------------------------------------------ 
----
Norman Gray  /  http://nxg.me.uk
eurovotech.org  /  University of Leicester, UK




-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642