[PD] variable typeof (WAS: creation time AND local variables in the same abstraction).

Frank Barknecht fbar at footils.org
Sun Aug 27 22:49:46 CEST 2006


Hallo,
Tas Pas hat gesagt: // Tas Pas wrote:

> I solved the problem I had storing the creation arguemet in an
> object.  Then I packed the creation argument with the variable I got
> from the openpanel and send the list to the message I wanted to fill
> with the two variables.
> 
> What I noticed was that if I have a float for a creation arguement,
> I couldn't store it, because I had a [symbol $1] object waiting to
> store the $1-creation argument and that couldn't be created (it had
> a dicontinuous sqare).
> 
> Is there a way to know the type of the creation argument so that you
> can call an abstraction with any type of arguement you want, or is
> it a good tactic to put a [float $1] and a [symbol $1] waiting to
> store the argument so that you don't care if one of these fail to be
> created?

You could use a [list append $x] to store both floats and symbols.
Combined with [route float symbol] you can handle both cases of
arguments in a single patch: 

 [loadbang]
 |
 [list append $1]
 |
 [route float symbol]
 |      |
 |      deal with symbols
 |
 do something with floats

However IMO it's better practice to define exactly what type you want
to have at which position of the arguments. This way you will get
better error messages if you do something wrong like trying to send a
symbol to an object that only deals with float numbers or creating a
[f O] object (that's an Oh, not a zer0 in the [f])

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




More information about the Pd-list mailing list