Re: classpath, compile

Dan <[email protected]> Thu, 28 Sep 2006 08:22:16 -0700 (PDT)
Newsgroups gmane.comp.java.sisc.user
Message-ID <[email protected]>
I ran some experiments on compile-file and require-library. Results below:

File x.scm:
(display '(lib x)) (newline)
(define-macro (mac1 x) (list 'list x))

File y.scm:
(display '(lib y)) (newline)
(require-library 'x)
(define (f x) (mac1 x))

Exit and re-enter SISC between experiments, and also issue "rm -f *.scc".

Experiments:

1) compile-file loads the file being compiled, but doesn't "provide" it to future require-library calls:

#;> (compile-file "x.scm" "x.scc")
(lib x)
#t
#;> (mac1 10)
(10)
#;> (require-library 'x)
(lib x)
(x)

2) compile-file executes (require-library) in sources as if typed in at the REPL prompt:

#;> (compile-file "y.scm" "y.scc")
(lib y)
(lib x)
#t
#;> (mac1 10)
(10)
#;> (require-library 'x)
#t

3) If the library is already loaded in the environment, compile-file doesn't load it again:

#;> (require-library 'x)
(lib x)
(x)
#;> (compile-file "y.scm" "y.scc")
(lib y)
#t

4) (load) is a reliable way to force reloading of (potentially updated) libraries:

#;> (require-library 'y)
(lib y)
(lib x)
(y (x))
#;> (require-library 'y)
#t
#;> (load "y.scm")
(lib y)
#;> (load "y.scm")
(lib y)
#;> 

The results seem to indicate that the compiler operates entirely in the current interaction-environment, except in exp. 1.

I don't know what the last line printed by require-library (when it actually loads something) could possibly mean.

-- Dan




-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV