[PD] what distinguishes a numeric symbol as an argument?
Frank Barknecht
fbar at footils.org
Thu May 31 20:25:52 CEST 2007
Hallo,
Matteo Sisti Sette hat gesagt: // Matteo Sisti Sette wrote:
> However, I can't see any difference between the output of the message box
> (*) in (4) and in (1-3).
> If I connect that message box to a [print] in any of the four examples
> above, the output is always "label 43".
[print] is very bad for showing these kinds of things.
> However, this does not explain the following:
>
> * Isn't the output of [makefilename] in example (4) just the same as [symbol
> 43( of example 3??
It isn't: [makefilename] always generates real symbols and it's the
only (usual) way to really numeric symbols. There was a thread on
pd-dev about this some time ago. The 43 in a message box [symbol 43(
is not a real numeric symbol. Actually "symbol 43" is kind of an
illegal message in Pd, as a proper symbol-message is built from the
word "symbol" and another "word", not a number. So to build a proper
word "43" first you need to generate a 43-symbol using [makefilename].
> Then why doesn't example 3 work as well???
>
> Also, consider this:
>
> (5)
> [label 43(
> |
> [unpack s f]
>
> and this
>
> (6)
> [symbol 43(
> |
> [label $1( (**)
> |
> [unpack s f]
>
> In example (5), the second outlet of unpack outputs float 43, which is
> (somewhat) coherent with the fact that example (1) didn't succeed to set the
> canvas label
> However, in example (6) unpack gives the error "unpack: type mismatch"... so
> I guess that the "$1" (i.e. the "43") in (**) is seen as a symbol, not a
> float.......
It's neither a symbol nor a float: To be a float, it would need to
have a selector of "float" or no selector at all, to be a symbol, the
data part of the message should be a symbol, but it is a float (43) so
your message is not valid.
> Oh shit!!!!!!!
>
> Now I see that the following:
> [symbol 43(
> |
> [print]
>
> just outputs "symbol "
Yes, [print] gets confused about the invalid message.
> while
> [43(
> |
> [makesymbol %d]
> |
> [print]
>
> outputs "symbol 43" as expected....
However this "43" now is indeed a symbol and you cannot input it into
a numberbox anymore. Try this:
[43(
|
[makefilename %d]
|
[$1(
|
[+ 10]
You get the error message:
error: +: no method for '43'
which indicates, that "43" now is a symbol-selector! (Let that sink
for a while ...) Numeric symbol selectors aren't used by many objects.
[select] can handle them, you can label GUI elements with them, you
can use them as targets for [send] through the second inlet, but you
cannot build a receiver for them: [r 43] is not valid, as in this case
"43" is still a float.
> isn't it weird??????
Ah, the fun of Pd's message system! But once you get to grips with it
you may see, that it's limited, but actually rather consistent. It'd
recommend an afternoon of list-archive reading, as this confuses many
people.
Ciao
--
Frank Barknecht _ ______footils.org_ __goto10.org__
More information about the Pd-list
mailing list