[PD] constants

Martin Peach martin.peach at sympatico.ca
Wed Feb 15 22:49:11 CET 2012


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.

Martin
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: str2ms.pd_lua
URL: <http://lists.puredata.info/pipermail/pd-list/attachments/20120215/2854b095/attachment.asc>


More information about the Pd-list mailing list