[PD] constants (was: Re: specifying time)

Mathieu Bouchard matju at artengine.ca
Thu Feb 16 19:39:41 CET 2012


Le 2012-02-15 à 13:11:00, Jonathan Wilkes a écrit :

> 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?

Compared to any code that checks whether something is A_FLOAT or not, and 
branches accordingly, it makes absolutely no speed difference for the case 
of A_FLOAT.

And for the other case... the difference is that if you rely on A_SYMBOL 
from being a type completely separate from A_FLOAT, for any reason, then 
you're toasted. It's actually the same issue as the auto-convert 
discussion from a while ago in which the symbol \123 would be regarded as 
float 123 if you look at it this way, or as symbol \123 if you look at it 
this way.

  ______________________________________________________________________
| Mathieu BOUCHARD ----- téléphone : +1.514.383.3801 ----- Montréal, QC


More information about the Pd-list mailing list