[PD] here I go again..dynamic abstractions

Claude Heiland-Allen claudiusmaximus at goto10.org
Sat Feb 7 01:04:49 CET 2009

Georg Werner wrote:
> hi,

Hi Georg,

> can somebody explain why there is a "3rd rule of $-expansion: 'there is 
> no $0 in message-boxes'".

The following is from an implementor's viewpoint, not a user's 
viewpoint, so be warned :)

I don't know why, but it makes parsing Pd patches 1000x less 
straightforward than required (you need a two-phase parser that has a 
special exception to detect message boxes and not expand dollars, 
allowing the message box objects to parse them itself later, while 
expanding dollars for everything else).

I ran into this problem implementing PotatoData (basically a proof of 
concept, it's a Pd patch interpreter written in Lua with minimal amounts 
of C for DSP, can run some trivial audio patches) a couple of months 
ago, and just ducked it completely - message boxes in my implementation 
don't support dollars at all (nor commas or semicolons for sequencing 
and redirection, but that's a separate issue).

I wish message boxes had used a different special character, it would 
have made life much much easier.

> i stumble every now and then about it and it is IMHO not 
> self-explanatory. 

It's a mess.  There are two similar concepts at work:

1. replacing dollars with arguments at patch execution time
2. replacing dollars with arguments at message passing time

But they both use the same $ symbol syntax in Pd, so you can't have both 
taking place (ie, use $ at patch execution to create a message box that 
has $ to replace at dataflow time).  And $0 is in phase 1, so what 
should a message box do with $0 in phase 2?

The confusion arises partly because when Pd loads a patch, it's really 
internally passing messages around.

$ in message boxes is unfortunate.  If there was a different symbol, 
perhaps #, you could combine both phases in one object box to avoid 
jumping through pointless hoops.

[$0-#1-$2-#3( would be nice, but as Pd is now, it's a nightmare.


More information about the Pd-list mailing list