[PD] opening patch from pd message

Roman Haefeli reduzent at gmail.com
Wed Nov 27 13:37:21 CET 2019


On Tue, 2019-11-26 at 18:33 +0100, IOhannes m zmölnig wrote:
> 
> # anatomy of a message
> 
> i think it is pretty easy:
> - any message in pd-land consists of a single selector and any number
> of
> atoms (including none).
> - an atom can be a number, a symbol, a gpointer and "other things"
> - a selector must always be a symbol.
> some special selectors need a fixed number of atoms, of a fixed type
> ("float" and "symbol" require exactly 1 atom of the resp. type;
> "bang"
> requires exactly 0 atoms); but these are special cases.
> 
> dollar-arguments in msgboxes (e.g. [open $1.wav() always refer to the
> atoms.
> 
> ## implicit selectors
> 
> if you have a msgbox [foo bar 1(, then this is a message with the
> selector "foo" and two atoms, a symbol "bar" and a number "1".
> 
> if you have a msgbox [1(, then the 1st element would be "1" (a
> number).
> since messages must always start with a selector (a symbol), it
> cannot
> start with the number "1". and Pd implicitely adds a default selector
> to
> this message. since the msg only consists of a single number atom,
> the
> implicitely added selector is "float".
> if you have a msgbox [1 bar foo(, we also miss a (symbol) selector,
> but
> the "float" selector requires a single atom (and our message has 3
> atoms, once we add a selector), so Pd adds a "list" selector.
> 
> # why do we need selectors?
> 
> so why are messages like they are in the first place?
> each object in Pd has a number of methods (functions that interact
> with
> the internal state of the object). objects and methods are something
> we
> know from object-oriented programming (C++, ...)
> in Pd, objects communicate via messages - and communication boils
> down
> to calling methods in other objects.
> so messages need some way to encode which method of the downstream
> object is being called: and this is what the selector does.
> e.g. an object might have a method for messages with the "foo"-
> selector
> and messages with the "bang" selector, but no messages with the
> "float"
> selector.
> 
> so if you want to stop a delay, you want to call the "stop" method of
> the [delay] object, thus sending a [stop( message (selector is
> "stop",
> no atoms).

This sums up the nature of Pd's message much more comprehensively than
what can be found in Pd's own HTML documentation, I find at least.

Roman


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: This is a digitally signed message part
URL: <http://lists.puredata.info/pipermail/pd-list/attachments/20191127/e153ba84/attachment.sig>


More information about the Pd-list mailing list