[PD] $-Dollar sign variables instantiation

Frank Barknecht fbar at footils.org
Wed Jul 19 20:34:35 CEST 2006


Hallo,
briencrean at eircom.net hat gesagt: // briencrean at eircom.net wrote:

> I have attached a simple patch below in txt format. I dont
> understand why when using the 'symbol' object I can instantiate the
> $1 variable to a string and when I try the same with the $2 variable
> it says "error: $2: argument number out of range".

Just to comment on that specific problem as well: By sending a message
[word( to a [symbol] object's first inlet, that message also will be
converted to a proper symbol message: "symbol word". Now if you send
this to a message [$1(, it will correctly print "word". But if you
send this to a message [$2( as in your patch, Pd complains, because
the message "symbol word" doesn't have a second data item to access
with $2. 

Also you seem to misunderstand the difference between $-variables in
messages and in object boxes. In object boxes, $1 will be replaced by
the first argument of the parent patch, that is, the patch that
includes an object having the same name as the patch, that contains
the [symbol $1] (the abstraction). 

However if open such an abstraction directly without calling it
through a parent patch, $1 and all subsequent $-variables in object
boxes will be initialised as 0. 

Anyway sending a message into a [symbol $1] object will overwrite that
initial argument with the incoming word.

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




More information about the Pd-list mailing list