[PD] Re: [PD-announce] k_guile v0.0.1

Kjetil Svalastog Matheussen k.s.matheussen at notam02.no
Sat Jan 24 15:38:25 CET 2004


On Sat, 24 Jan 2004, Larry Troxler wrote:

> 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.

Hmmmm. :) Don't know what scoped means... (Don't know common lisp!)
Can't you just try things out and see how it behaves?


>
>
> > 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.
>
(display) should work, but you must remember to use (newline) afterwords.
(pd-display) does both.


> > 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?

Yes, thats right.

> Isn't this script called from the "setup" function?

Its called inside the k_guile setup function. The function that
defines the k_guile external in pd. Its only called once.

> (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?
>

I think you just have to try things out.

-- 




More information about the Pd-list mailing list