[PD-dev] strings

martin.peach at sympatico.ca martin.peach at sympatico.ca
Mon Dec 18 19:34:03 CET 2006


> 
> De: Hans-Christoph Steiner <hans at eds.org>
> Date: 2006/12/18 lun. AM 09:45:26 GMT-05:00
> À: carmen <_ at whats-your.name>
> Cc: pd-dev at 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 at iem.at
> > http://lists.puredata.info/listinfo/pd-dev
> 
> 
> 
> ------------------------------------------------------------------------
> 
> Mistrust authority - promote decentralization.  - the hacker ethic
> 
> 
> 
> _______________________________________________
> PD-dev mailing list
> PD-dev at iem.at
> http://lists.puredata.info/listinfo/pd-dev
> 





More information about the Pd-dev mailing list