On Feb 6, 2006, at 8:11 AM, Frank Barknecht wrote:
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 bei 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.
I propose "element" and "series" as general words. "set" was a bad
word because is means something without order. A "series" has order,
so it makes more sense. We should not use the existing terms to define
things because we are trying to eliminate the current confusion of how
these terms are defined.
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.
Nomenclature (not scientific)
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).
"Word" has other meanings in computer land. Plus "1.1.1.1" is not a
number, nor is it a "thing you can look up in a dictionary". But
[list 1.1.1.1( is a symbol, not a float. So it is symbolic rather than
numeric, and it is a basic element, it is not divided within Pd (unless
you are using objects which are meant to chop up symbolic elements).
Atomic messages
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"
It just needs something like: bang means "do something".
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.
"float" doesn't get prepended, but rather implied. For example:
[5( | [+ 5]
The output is [10(, not [float 10(. The "float" is therefore implied
rather than 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?)
Something like "a pointer to a position in a data structure", but I
think the existing definitions are clear. Or at least, I never had any
confusion over what it meant (using it was a different story ;)
List-messages
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
Can you even have a list of pointers? I didn't think so. I know that
there is not [route pointer] unless that's changed with 0.39. (Or
rather [route pointer] routes "selector series" or "symbolic element"
messages with the selector "pointer", but not the data type "pointer").
Implied list-selector .....................
A multi-atom message that starts with a number is a list-message, too. (Cf. implied selector in float-messages)
"atom" is not clearly defined, so I think we should stick with
"element" in our definitions.
Meta-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.
This defines "selector series" in terms of messages though. When a
"selector series" is stored in an [any], it is not a message. Messages
and data types are distinct things in Pd, therefore should be defined
distinctly.
.hc
"The arc of history bends towards justice."
- Dr. Martin Luther King, Jr.