[PD] throw/catch vs send/recieve

Frank Barknecht fbar at footils.org
Wed Aug 20 18:43:18 CEST 2003


Hallo,
derek at x-i.net hat gesagt: // derek at x-i.net wrote:

> Quoting Frank Barknecht <fbar at footils.org>:
> 
> > Yes, but $0 is special in that it is replaced by a unique number for
> > each abstraction (not for each subpatch!).
> 
> 
> ok, now i am a bit confused ;-)
> how does this work? where does the variable for this $ come from then? 

It's internal to Pd. I cannot test right now, but I think, that the
first $0 used when Pd is running internally is replaced with 1000, the
second with 1001 and so on. But this might change in the future.  What
is important is that $0 is really unique for an abstraction. I use
this a lot to let patches have local values. For example, you can name
a table $0-settings and then store local settings in it. The
abstraction then can be used multiple times and still each one has
their own settings table that does not interfere with the others. Also
local send and receive is a common usage: [s $0-note] and [r $0-note]
will not send globally through patch boundaries but only inside one
abstraction. 

Another trick, to end this list, is to combine $x-arguments and $0
together with makefilename. Say you want to give an argument to an
abstraction but also use this for some local operations. You can then
use: 
  
  [f $1]
  |
  [makefilename $0-%d]
  |
  ... do something with $0-$1

This can give headaches, but it's very cool sometimes. ;)

ciao
-- 
 Frank Barknecht                               _ ______footils.org__




More information about the Pd-list mailing list