[PD-dev] treating $1 as an argument in A_GIMME

Christof Ressi info at christofressi.com
Fri Sep 17 17:59:41 CEST 2021


> Hi, when using A_GIMME I can test if the type is A_FLOAT or A_SYMBOL, 
> but if I give it a "$1", for instance, it's treated as a float.
Well, it depends on the actual value of "$1". In the case of 
[cyclone/play~ $1], the "$1" is replaced by its actual value before 
being passed to the object. A_GIMME (and Pd lists in general) doesn't 
know anything about dollars or dollarsyms, all list items are either 
A_FLOAT, A_SYMBOL or A_POINTER.
> Now, if I have 'A_DEFSYM' instead of 'A_GIMME', then '$1' is 
> considered as a symbol.

I guess what happens is that you instantiate [cyclone/play~] on a top 
level canvas (which doesn't have creation arguments), so the value of 
"$1" is always "0". A_DEFSYM converts non-symbols to an empty symbol.

So there is nothing to worry about. I guess the easiest way is to just 
use A_SYMBOL, so Pd will automatically give an error if you try to pass 
it a float. Otherwise use A_GIMME and check manually.

Christof






More information about the Pd-dev mailing list