symbols versus strings ? writing route

Miller Puckette mpuckett at man104nfs.UCSD.EDU
Mon Mar 23 19:40:04 CET 1998

In response to Winfried's questions about route:

>if a a string is for example "int", a used symbol, than route_symbol(...)
seg_faults, because pd_float is used for calling route_symbol(..) with
wrong arguments, because  the route_symbol(...) is registered as

... so you always have to write the "float", etc, methods as special
cases.  As a first cut, you can just have the "float" and "bang" method
call the "anything" method with the arguments re-assigned, as in

route_float(t_route *x, t_float f)
    t_atom arg;
    atom_setfloat(&arg, f);
    route_anything(x, &s_float, 1, &arg);

>So the string "int" or "float" matches all  numbers. Lists, which in
fact are lists beginning with numbers not strings, are handled
correctly. Lists with beginning strings are handled as methods --- is
this correct ?

Yep.  In a message box, you  have to say "list" explicitly if the list starts
 with a symbol; otherwise the symbol is taken as a selector instead of "list".

>So the my idea of route (to be compatible in future with real route)
could be that "float", "int" routes all integers and floats, which are
not in a list, 

(route should be fast, since, in my experience with max, it is often
used for sending synthesis parameters and has to handle high

I think you don't have to treat numbers and symbols in the same object;
it just complicates the thing and you can always put a "number" route on the
"list" output of a "symbol" route if that's what you need.


More information about the Pd-list mailing list