De: Hans-Christoph Steiner hans@eds.org Date: 2006/12/18 lun. AM 09:45:26 GMT-05:00 À: carmen _@whats-your.name Cc: pd-dev@iem.at Objet: Re: [PD-dev] strings
On Dec 18, 2006, at 1:23 AM, carmen wrote:
Automatic type conversion sounds like a really bad idea if the language only partially supports it. Pd is strongly typed
is it? it mainly has numbers that occasionally look like symbols, and symbols that more than occasionally look like lists and/or strings..
There are set rules which defined what is a float, symbol, or pointer. You cannot change that type, often even with a special method. Ever tried to turn a float into a symbol? Doesn't really work, only partially.
Along the lines of pd_defaultlist() in m_class.c, which handles list messages for objects that don't have list methods, one could add a pd_defaultstring(), which attempts to convert strings into symbols/floats/lists, instead of calling pd_defaultanything(), which would print "no method for string". But it needs to be understood that it might not do it correctly, which is Not A Good Thing, but no worse than comments getting mangled. Maybe a [string unpack] object would be better: it could attempt to unpack a string into specified types, so the user could decide if a string like "123" is meant to represent a float or a symbol.
Martin
.hc
, so what Martin says is definitely appropriate. Perl is the opposite, everything can be automatically cast, so there it makes sense.
it is definitely a design decision which way to go. could PD flexibly support both at once? or does there need to be an OCaml edition, and a Perl edition?
PD-dev mailing list PD-dev@iem.at http://lists.puredata.info/listinfo/pd-dev
Mistrust authority - promote decentralization. - the hacker ethic
PD-dev mailing list PD-dev@iem.at http://lists.puredata.info/listinfo/pd-dev
On Mon, 18 Dec 2006, martin.peach@sympatico.ca wrote:
symbols/floats/lists, instead of calling pd_defaultanything(), which would print "no method for string".
BTW I've just decided that my A_STRING atom type wouldn't have its own selector... its selector will be just "symbol". There's no real use to make strings and symbols any more segregated than that: most of the time, the user doesn't need to know. What class_addstring() will do is same as class_addsymbol(), but setting a flag saying that this symbol-method actually wants an A_STRING.
_ _ __ ___ _____ ________ _____________ _____________________ ... | Mathieu Bouchard - tél:+1.514.383.3801 - http://artengine.ca/matju | Freelance Digital Arts Engineer, Montréal QC Canada