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

Kjetil Svalastog Matheussen k.s.matheussen at notam02.no
Wed Jan 14 16:22:32 CET 2004


On Tue, 13 Jan 2004, Larry Troxler wrote:

> > But, local.scm can't be (load)-ed, because its inside a
> > function called "pd-instance-func" (see k_guile_load). The function works
> > like this:
> >
> > (define (pd-instance-func pd-instance)
> >   (eval-file "local.scm")
> >   (eval-file file)
> >   (pd-set-inlet-func)
> >   (pd-set-cleanup-func))
> >
> > and is created and defined for each time a file is loaded in k_guile.
> >
> Hmm, I guess I have to learn more about Scheme to understand this - until now,
> I've been used to using Common Lisp, and have never really learned the
> standard Scheme language.
>
> I have to say, it does seem very strange that you would have to resort to such
> a horrible klugde to boot up your scheme code.  Does it have something to do
> with the fact that you want a seperate interpreter for each object?
>

Not exactly, all code is run in the same interpreter. But the (define)
thing is to let each instance run in its own namespace.

Say you have the following script called setnum.scm:

(define number 0)
(pd-inlet 0 'setnum (lambda (n) (set! number n))

If you have two [k_guile setnum.scm] objects in a pd patch and the
scripts are loaded into the global environment, "number" will
be written from both objects, because they both use the same "number"
variable.


> Incidently, I'm really doubting about how using seperate interpreters for each
> object could work for someone who wants to use Common Music in scheme within
> PD.
>
> But hopefully other people who are more experienced in Scheme as a opposed to
> Common Lisp, will chime in here. It could well be that I'm missing some level
> of understanding, or am simply of the minority opinion.
>
Scheme is built around environments, which is a namespace. For each
new lambda/define a new environment is made. (Or something like that,
at least)


> >
> > The second reason is that by including global.scm and local.scm
> > directly into the k_guile.pd-linux binary instead of loading the
> > files somehow, there is no problem finding those
> > files when running the k_guile external. local.scm and global.scm aren't
> > supposed to be changed very often anyway.
>
> I personally don't agree with this argument. No matter what, in order to make
> use of your external, those scheme files need to be available. The only
> distinction is whether you need them at the time you build the external, or
> whether they need to be there at the time you load the external into PD.
> Either way, they need to be there.
>
Users don't have (or at least shouldn't have) any need for local.scm or
global.scm by runtime, and the files are therefore unnecesarry when
running k_guile. Letting the files be loaded at runtime only introduce
extra unnecesarry complexity for the user.


-- 




More information about the Pd-list mailing list