[PD] constants

Jonathan Wilkes jancsika at yahoo.com
Wed Feb 15 23:47:31 CET 2012

----- Original Message -----
> From: Martin Peach <martin.peach at sympatico.ca>
> To: Jonathan Wilkes <jancsika at yahoo.com>
> Cc: IOhannes m zmoelnig <zmoelnig at iem.at>; "pd-list at iem.at" <pd-list at iem.at>
> Sent: Wednesday, February 15, 2012 4:49 PM
> Subject: Re: [PD] constants
> On 2012-02-15 16:11, Jonathan Wilkes wrote:
>>  Let's go back:
>>  Instead of time units, let's take the incoming single-selector 
> "pi" and replace it with
>>  the float value of pi for any object that doesn't have a "pi" 
> method or an
>>  "anything" method (but does have a float method).  Furthermore, 
> if a class defines a
>>  float argument but the argument provided isn't a float, then check 
> first if what it received
>>  was A_SYMBOL 'pi' and if so replace with the float value of pi.
>>  Is what I wrote above possible to do without causing huge problems to 
> performance or
>>  creating ambiguities?  Is it something people would look at as a feature, 
> or a nuisance that
>>  makes it harder to learn Pd?  If the answer is that something like this 
> constant expansion
>>  is a bad idea then there's no point discussing macro expansion for time 
> units.
>>  -Jonathan
> I think it's a bad idea to make assumptions like that. It would be far 
> better to interpose a filter when needed. I attach a pdlua script [str2ms] that 
> will output a float millisecond value given some kind of string specifying time. 
> It's very easy to extend to other time types and only needs to be used if 
> you want it, not like some secret apple troll lurking inside the object that 
> "knows" what I want.

But "what you want" in this case is necessarily always an error to the console, 
without the possibility of doing something else instead.

Is there a way to give the user an option of what happens, like:
[badarg pi 3.14...]  <-- if the bad arg is "pi" substitute 3.14... and create the object


> Martin

More information about the Pd-list mailing list