Symbols and Singletons [was: Re: [PD] Segmented Patch Chords? PVar / PV?]

Frank Barknecht fbar at footils.org
Wed Feb 15 00:06:58 CET 2006


Hallo,
IOhannes m zmoelnig hat gesagt: // IOhannes m zmoelnig wrote:

> Roman Haefeli wrote:
> 
> > [r mysynth]
> > |
> > [route freq amplitude]
> 
> this uses at least 5 symbols ("r", "mysynth", "route", "freq", "amplitude")

Though "r" and "route" probably are already used anyway, so these two
shouldn't matter (or do they?).

> > causes less pollution than something like this:
> > 
> > [r mysynth-freq]
> > 
> > [r mysynth-amplitude]
> 
> this uses at least 3 symbols ("r", "mysynth-freq", "mysynth-amplitude")

Still I often prefer the first idiom, simply because in my patches,
"receiver namespace pollution" is more a problem than the size of the
symbol table. Many things in Pd can become targets for senders, most
notably these are tables, subpatches and real receivers. 

Limiting the chances of accidentally hitting one of these is quite
important to me. That's why I almost always use $0 to name tables,
receivers and even subpatches, and I tend to use UPPERCASE names for
everything, which doesn't have $0 in front, to make it even more
clear, that these are not only accessible, but generally also intended
for global access.

Somehow related to this:

I'm still undecided if [struct] names should also be named with $0.
It's easier to work with when embedding [struct]s in abstractions and
to avoid possible name clashes. However it's much harder to save and
restore the contents of a graph subpatch to a file, if the name
contains $0. This still is an open question when I really start to
build RRADical abstractions that use data structure GUIs: Should I
embed or should I require users to open a graph library patch? And how
do I make sure, that this graph library patch will be open exactly
once? Any ideas for how to implement such a Singleton pattern in Pd? 

Ciao
-- 
 Frank Barknecht                 _ ______footils.org_ __goto10.org__




More information about the Pd-list mailing list