[PD] Re: [PD-dev] Re: prepend w/ set message - ignore

Mathieu Bouchard matju at sympatico.ca
Fri Dec 31 18:57:04 CET 2004


On Thu, 30 Dec 2004, Miller Puckette wrote:

> I'm guessing |msg prepend test| would send a |test( message when
> banged (but have to think carefully about the design of a good
> "prepend" functionality and look at the existing ones to figure out
> what to do there...)

Well, while it's good to look at other existing [prepend]s, the behaviour
of an official [prepend] should depend on what is consistent with pd; I
mean consistent as in "what obeys to as few special rules as possible". So
it would be good to come up with explanations about why it makes sense to
have [prepend] behave a certain way.

I have written a [messageprepend] class (bundled with GF). When prepending
a single element to a message, that element becomes the selector, and the
former selector becomes $1, and so on.

This means that a bang becomes "test bang", and a 42 becomes "test float
42", and "1 2 3" becomes "test list 1 2 3". In the latter two cases, this
involves the fact that a messagebox inserts a default selector where
applicable.

In the Ruby-for-Pd external (aka gridflow.pd-*) I have a few automatic
conversions going on, so that if you do send_out(0) then it's like doing
send_out(0,:bang) (the colon is the symbol prefix in Ruby).

However, conversions are _never_ made the other way around: while
nothingness may be considered a bang, a bang is then never considered like
nothingness. The same applies to send_out(0,42) which is equivalent to
send_out(0,:float,42), but once the first form is seen as the second one,
there's no going back to the first one.

The reason can be distilled to one simple sentence:

  A message always has a selector (of type Symbol).

_____________________________________________________________________
Mathieu Bouchard -=- Montréal QC Canada -=- http://artengine.ca/matju





More information about the Pd-list mailing list