On Thursday 15 January 2004 05:14, Kjetil Svalastog Matheussen wrote:
On Wed, 14 Jan 2004, Larry Troxler wrote:
On Wednesday 14 January 2004 10:22, Kjetil Svalastog Matheussen wrote:
Not exactly, all code is run in the same interpreter. But the (define) thing is to let each instance run in its own namespace.
Is what you refer to as a "namespace", the same as what Common Lisp would refer to as a "closure"? In common lisp, such a function definition would create a "closure", which is I think a persistent "environment", and "environment" being a set of symbol bindings more or less.
I don't know what a closure is actually. But you can think of an environment (which defines the nearest namespace) as a stack only that it doesn't dissapear unless not referenced to anymore. Its not complicated, I just dont know how to explain properly.
Ok, understood. When you said "namespace", I started wondering whether scheme had a mechanism similar to Common Lisp's "packages".
So, if I understand you correctly, a "namespace" in scheme is a staticly scoped environment.
In the CVS I added (load-if-exists "/etc/k_guile.scm")(load-if-exists "$HOME/.k_guile.scm") into global.scm.
Finally got it (after waiting the sourceforge lag-time - they really have to do something about that if they're serious about keeping projects on their site). At the moment I'm not sure if this is working - I'm using (display) in my .k_guile.scm to announce itself but I hear nothing, and it should be also loading Common Music. Probably I need to go to a Scheme site and learn more about Scheme output to the console.
So if you put something like the following code:
" (define common-music-loaded #f) (define (load-common-music) (if (not common-music-loaded) (load "path-to-common-music/cm.scm")) (set! common-music-loaded #t)) "
into /etc/k_guile.scm, you can safely call (load-common-music) in your scheme programs used for k_guile.
Isn't this called from global.scm, which is run when the library is first loaded? Isn't this script called from the "setup" function? (I think this is the source of all my confusion - what does PD do about loading libraries that define a single extern). If so, why do you need that singleton pattern?
Larry Troxler