[PD-dev] class_addmethod2

Mathieu Bouchard matju at artengine.ca
Sat Dec 17 15:16:18 CET 2005


On Thu, 15 Dec 2005, Miller Puckette wrote:

> How about calling this "class_addv" or, possibly, "class_vmess"?

Why would it be called by either of those names? it doesn't do "addv", it 
only reminds of addv's syntax, but then so do my functions pd_scanargs, 
pd_saveargs, sys_mgui, and some future ones too (pd_setargs).

> I think it's a much better design than class_addmethod and I should add
> it, once we figure out the best name, to the "main" API.

I think it should be more polished before being added to any API. Here are 
the changes that I propose:

> > f=A_FLOAT   F=A_DEFFLOAT
> > s=A_SYMBOL  S=A_DEFSYMBOL
> > p=A_POINTER

add "=" meaning DEFAULT (the equal sign is the default-value sign in C++, 
Python, Ruby) such that all subsequent A_FLOAT and A_SYMBOL and A_POINTER 
are treated as default. That would introduce a default-pointer feature 
and would deprecate A_DEFFLOAT, A_DEFSYM, A_DEFSYMBOL.

(there's a default-value feature called ";" in pd_scanargs but it works
differently and it mentally conflicts with binbuf's idea of ";". I don't
recall why I picked ";" in the first place, but I was inspired by an
equivalent mechanism in Ruby)

the problem with that "=" (and A_DEFFLOAT etc) is that it doesn't allow to
specify default atom values other than zero and null-symbol, contrary to 
how the "=" works in C++/Python/Ruby.

> > *=A_GIMME

A_GIMME would come to work with other specifiers, as long as it is 
supplied last, so "fs*" would result in args like (t_pd *, t_float, 
t_symbol*, int argc, t_atom *argv) where argc,argv would only represent 
the _rest_ of the args. The "=" specifier can be combined so that there 
can be mandatory-args, optional-args and rest-args in the same message.

That usage of "*" would be consistent with the splat-operator (unary *) in
Python and Ruby, and equivalent concepts in other languages: the "&rest"
macro in CommonLISP; the "args" keyword in Tcl.

> > !=A_CANT  (e.g. for dsp messages)

I'd like to have more doc on how A_CANT is _meant_ to be used.

 _ _ __ ___ _____ ________ _____________ _____________________ ...
| Mathieu Bouchard - tél:+1.514.383.3801 - http://artengine.ca/matju
| Freelance Digital Arts Engineer, Montréal QC Canada




More information about the Pd-dev mailing list