Hallo, IOhannes m zmoelnig hat gesagt: // IOhannes m zmoelnig wrote:
Hans-Christoph Steiner wrote:
Here are some attempts at definitions:
list: a series of 2 or more elements whose first element is either the selector "list", or a float, which causes the "list" selector to be
i think this is a bad start. implying "list" or "float" is an exception and should be handled as such: at the very end of the documentation! if people would use [float 1( instead of [1(, then i think that there would be less confusion. so we should get people to _think_ [float 1(, even though they _write_ [1(.
I agree that a "bottom up" approach to get clear definitions would be better. That is, first start with the possible elements/atoms: floats/numbers, symbols, words (i.e. "symbols" without "symbol" selector), bang and pointer.
After these are defined, one could talk about how messages with more than one atom are handled: those with a proper "list" selector, those with an implied "list" selector and those with a different selector (out of band-/meta-messages).
Maybe this whole discussion should not so much focus on "data type" anyway, but instead on "messages", because all of these things in practice are only important when it comes to how Pd objects deal with messages while communicating with each other.
Here's my quick try at definitions using that approach.
============== Messages in Pd ==============
Objects in Pd send each other various data in the form of messages. Messages can transport various kinds of information: single numbers and words, groups of numbers and words etc. Understanding the various ways to built and work with messages is a key to understanding Pd.
number: something you count and compute with like 1, 0.1, 1.21e+20
word: the thing you can look up in a dictionary and that is not a number as above. Normally must not contain whitespace (unless properly escaped).
bang:
The most basic message is "bang". It consists of the single word "bang" for example written in a message box. There also is the object [bang] (short [b]) which transforms every incoming message to a "bang"-message.
Anatomy of a bang-message:
"bang"
float:
A message that starts with the word "float" followed by exactly one number. The first word "float" is also called the selector. Examples "float 1", "float -3.4", "float 1.21e+20". A message that only contains a number internally gets the word "float" prepended.
Anatomy of a float-message:
Selector: float (can be implied)
Data: one number
symbol:
A message that starts with the word "symbol" followed by (exactly) one word. The first word "symbol" is also called the selector. If there are more words or numbers following the data word, they get truncated to create a proper symbol-message.
Anatomy of a symbol-message:
Selector: symbol (can not be implied!)
Data: one word
pointer:
(Uhm, how to define a pointer?)
The official text by Miller (list-help.pd):
Messages in Pd are somewhat artificially divided into two classes. First are data-holding messages (bang, float, symbol, list) which are the primary way of communicating between objects. Second is "everything else" (you could call them out-of-band messages or metamessages) that describe changes in configuration, read and write files, quit Pd, etc. These are provided so that complex objects don't need to have 100 separate inlets for every possible functionality. It's not clear whether this was a good design choice, but it's entrenched.
The distinction becomes visible, and ugly, when the leading item in a data-holding message is a symbol (i.e. word, fbar). In this case, to disambiguate it from the other sort, the printed form of the message has a selector, "list" or "symbol" prepended to it. Underneath, there is always a selector in fromt of data messages, but it is implied if the first data item is a number.
My take:
A list-message is a multi-atom message starting with the word "list" as selector. List-messages can be generated using the [list] object family, which all convert their input to a list-message and - except [list trim] - they all output proper list-messages. [list trim] splits off the "list"-selector and just passes the data part of a list-message.
List-messages with just one element are handled specially, see below.
Anatomy of a list-message:
Selector: list (can be implied, if data starts with a number)
Data: normally at least two atoms (words, numbers or
pointers). One-atom list-messages get converted to
atomic messages, see below.
One-element lists .................
If a list-message's data contains zero or one elements, the message gets converted to an atomic message according to the following rules:
No data: conversion to bang-message. One word: conversion to symbol-message One number: conversion to float message. One pointer: conversion to pointer
Implied list-selector .....................
A multi-atom message that starts with a number is a list-message, too. (Cf. implied selector in float-messages)
Messages that are neither pointers, float-, symbol-, list- nor bang-messages.
Meta-messages can be generated out of atomic and list-messages using [list trim]. Many objects like [openpanel], [tabread] etc. accept and generate meta-message for administrative tasks.
Anatomy of a meta-message:
Selector: a word that is not "float", "symbol", "list" nor "bang"
Data: anything
Examples:
"reset"
"read -resize soundfile.wav"
"set pd-%s"
"/synth/param 0 127"
Hey, that was a short definition of meta-messages.
Frank Barknecht _ ______footils.org_ __goto10.org__