[PD] dealing with arguments and inlets

Hans-Christoph Steiner hans at eds.org
Sun Feb 5 20:26:12 CET 2006


On Feb 4, 2006, at 3:51 PM, Mathieu Bouchard wrote:

> On Sat, 4 Feb 2006, Hans-Christoph Steiner wrote:
>
>> I don't entirely get how it works, looking at the help patch.  What  
>> are the
>> "attributes"?
>
> Attributes are specific to Flext/Pyext, although GridFlow has a  
> variant on
> this concept. It's not used in Pd. It's like what's called Keyword
> Arguments in several languages like Python and CommonLisp, and it's  
> like
> the dash options in Tcl (though in Tcl it's not a language feature,  
> just a
> convention).
>
>>  Is [patcherargs 10 20] like this: [float $1]  [float $2]?
>
> I guess so, except that $1 defaults to 10, instead of defaulting to 0,  
> or
> worse, instead that whenever $1 is 0, it gets replaced by 10...
>
> [patcherargs] seems to allow any number of arguments in the parent  
> patch
> and so can be used to support varargs abstractions, something that  
> plain
> Pd can't because you can't even know how many args you really have.
>
> Plus, [patcherargs] gives it as a list, which is then easy to process
> using [list] (and that's something that Frank will love).
>
>> It seems to be a black box, which I am not a fan of.  I think we can  
>> do
>> it cleaner and do it mostly in Pd.
>
> I'm trying to say that Pd is broken and that [patcherargs] is  
> cleaner...
>
> It wouldn't need to have the "attributes" part available, so you could
> drop the second outlet and then it would be a very small and simple
> external whose code fits on a page. Of course I think it should be
> internal.

[float_argument], [symbol_argument], and [any_argument] (previously  
[list_argument]) can do defaults like this: [symbol_argument $1  
default]  so we already got that part of [patcherargs] covered.

As for using an indeterminate amount of arguments, I think that would  
be better supported using $# and $@ in Pd (or perhaps $argc and $argv).

.hc

________________________________________________________________________ 
____

If you are not part of the solution, you are part of the problem.
                                                               -  
Eldridge Cleaver





More information about the Pd-list mailing list