On Nov 1, 2006, at 9:02 AM, Mathieu Bouchard wrote:
On Wed, 1 Nov 2006, Frank Barknecht wrote:
Hans-Christoph Steiner hat gesagt: // Hans-Christoph Steiner wrote:
Then to make iemlib/split.pd_darwin work as [split], one would use [declare iemlib] or [import iemlib].
Syntax suggestion: what about [declare -import iemlib]?
Some consensus on how to do things like that ("keyword arguments") ould help:
In Flext/Jitter style: [declare @import iemlib].
In Unix/Tcl/Toxy style: [declare -import iemlib].
In GridFlow style: [declare, import iemlib], where "import" is a
selector and the name of a method, and the comma is like [initbang].
The use of "@" to mean "attribute" may remind of Ruby, but in Ruby, "@" is a kind of variable, not a kind of argument.
The GridFlow style relies on the ability to replace keyword arguments of a constructor by a bunch of little messages that modify the object just after it's constructed (this is not always possible).
One of (1) and (2) is redundant. Then I wouldn't know which of that or (3) to pick. The (3) has the important concept that every option is runtime-configurable. That might not be an issue for [declare], but that is an issue for other object classes that [declare] would be consistent with.
How would you specify multiple imports? It may make the difference between Unix style and Tcl style:
[declare -import foo -import bar] <- unix [declare -import {foo bar}] <- tcl
because in tcl style, every time an option is specified, it has to completely override the existing option of the same name: it can't add up like pd's -lib -path -helppath. Pd doesn't accept {} so here are some possible replacements:
[declare -import (foo bar)] <- GF-style nested lists [declare -import foo bar] <- use dash-prefixed symbols as delimiters [declare, import foo bar] <- use comma as delimiter
One very important aspect of Pd is its very minimal syntax. I think its quite important to preserve that. I definitely agree we should have a standard way of doing this kind of thing, but I don't really like any of the above options. Pd is not Ruby, Tcl, C, UNIX, etc. and it shouldn't follow those conventions without really good reasons to break the current syntax.
Adding commas and () in object boxes is totally unprecedented and I can't see any benefit. Perhaps this extended syntax is useful in other situations, but I think this situation could easily be taken care of using only current syntax:
patch-local ----------- [import foo bar] [path foo bar]
global ------ [global_import foo bar] [global_path foo bar]
I think it could make more sense to have the global settings controlled by messages. These settings are already controlled separately from the patch itself and hidden in the preferecne panels and files, so it terms of the patch representing the run state, I don't think it would make a difference; that stuff is outside of the realm of the patch. So it could look like this:
[;pd import foo bar( [;pd path foo bar(
.hc
------------------------------------------------------------------------
Computer science is no more related to the computer than astronomy is related to the telescope. -Edsger Dykstra