[PD] dealing with arguments and inlets

Hans-Christoph Steiner hans at eds.org
Fri Feb 3 23:07:34 CET 2006


On Jan 31, 2006, at 6:16 AM, Frank Barknecht wrote:

> Hallo,
> Hans-Christoph Steiner hat gesagt: // Hans-Christoph Steiner wrote:
>
>> I have written some classes for handling arguments when writing  
>> classes
>> in Pd.  They are [float_argument], [symbol_argument], and
>> [any_argument].  Currently, I am thinking in general,  inlets should  
>> be
>> matched to arguments and vice versa,
>
> "should match" would be oversimplyfiying, but having an extra inlet in
> the argument-patches never hurts.

I mean in general, but of course, there should be room for exceptions.



>> so these objects all have a
>> "convenience" right inlet, to attach the [inlet] to so that the data
>> all comes from the [*_argument] object.
>>
>> To use them, you add the argument you want it to handle like this:
>>
>> [float_argument $1]
>>
>> If you want a default value for when none is specified, you would do  
>> it
>> like this:
>>
>> [float_argument $2 234]
>> [symbol_argument $3 default]
>> [any_argument $9 asdf]
>> [any_argument $5 444]
>
> I attached "list_argument" which does the same as "any_argument" but
> doesn't require any externals and is much simpler than [any_arg...].
> In fact, it's just [float_argument] where "float" is replaced by "list
> append".
>
> Note that I would much prefer, if [list_argument] would be renamed to
> be [any_argument] and replace it.
>
> Reason is: The name "list_argument" could lead to wrong expectations:  
> It doesn't
> handle variable length lists as arguments, because that is impossible
> without externals like dollarg. It just handles one-element lists
> which get auto-converted to their respective type: "symbol x" or
> "float x".
>
> Of course it won't work with Pd < 0.39.
>
> Regarding symbol_- and float_argument: These could be implemented as:
>
>   [list_argument $1 $2] or [any_argument]
>   |
>   [route symbol] or [route float]
>   |
>   [outlet]
>
> to share more code. Because Pd autoconverts one-element lists, there
> will always be a proper selector to make [route] do The Right Thing.

[list_anything] looks good, fine by me if it becomes [any_argument].   
But the question I have now is what should we call this library?  I  
plan on writing a lot of objects that make it easier to write objects  
in Pd.  Here are some random ideas on names:

foundation
support
language

hmm... none of them seem great to me...

.hc


________________________________________________________________________ 
____

"If nature has made any one thing less susceptible than all others of  
exclusive property, it is the action of the thinking power called an  
idea, which an individual may exclusively possess as long as he keeps  
it to himself; but the moment it is divulged, it forces itself into the  
possession of everyone, and the receiver cannot dispossess himself of  
it."
                                                        - Thomas  
Jefferson





More information about the Pd-list mailing list