[PD-dev] abstractions

Mathieu Bouchard matju at artengine.ca
Wed Jul 9 19:00:25 CEST 2008


On Wed, 9 Jul 2008, Frank Barknecht wrote:

> I think, Pd could benefit a lot by providing a default scripting 
> language to write operations like [range] which are tediuos to do as an 
> abstraction.

At this point I don't mind having it written in C++, really. The code is 
only 25 lines long and I can see it getting shorter as I introduce more 
shortcuts.

> Altough I'm not a fan of Tcl (and would prefer Lua), Tcl would be a 
> natural choice as it's available anyway.

That's what I thought, but then I realised that I was less of a fan of Tcl 
than I previously thought. In the end I decided to stick with C++ and Pd 
(abstractions). I decided that this would be a good occasion to make it 
easier to make abstractions.

I don't know Lua, but even though reading about it doesn't make me think 
that the syntax is cool like Tcl's is, I can't really stand "everything is 
a string" in Tcl. I don't mind the lack of a standard object model in Lua, 
as Tcl also lacks one, so I wrote myself one in a record low number of 
lines.

> Ideally the scripts would be saved within the patch, e.g. inside message 
> boxes.

That's not quite ideal, because it makes it hard to load once and use many 
times. It's already a problem with Pd abstractions... the whole patch 
structure is being reloaded repeatedly, and even reparsed. If you use an 
abstraction 100 times, it will have 100 copies of the connections and will 
have parsed the abstraction 100 times.

> Oh wait, that's toxy! Hm, ... but toxy has a horrible syntax, which I 
> could never get around.

That's because Pd has a horrible sin tax. It can be bypassed by making a 
GUI object specific to that, that will allow to write and paste source 
code directly into a box, without being hindered by Pd's syntax.

> But the general approach of it is a fantastic idea.

I agree, as long as there is also the alternative of not writing source 
code in patches.

> The advantages of a scripted Pd classes are: For certain tasks,
> especially those involving lots of repetition, patching is too much
> work.

Many patterns of lots of repetition can be covered using some classes that 
would work like [nqpoly] and [polypoly] but better.

> And as pd-extended shows, if you pack each and every external and 
> abstraction into the pd-distribution, you either have to deal with ugly 
> long names or live with namespace pollution.

This is a separate issue that is mostly unrelated to scripting.

  _ _ __ ___ _____ ________ _____________ _____________________ ...
| Mathieu Bouchard - tél:+1.514.383.3801, Montréal, Québec


More information about the Pd-dev mailing list