[PD-dev] strings

Mathieu Bouchard matju at artengine.ca
Sat Dec 16 01:40:03 CET 2006


On Fri, 15 Dec 2006, Hans-Christoph Steiner wrote:

> But yes, it leaves a lot to be desired.  Bryan Jurish has taken a 
> different approach, which is to use lists of bytes to represent strings. 
> Might be worth checking out.

An advantage using the list-of-bytes approach is that because each 
character can be represented by a rather large integer, it can be extended 
to work on lists-of-characters meaning quickly, if there is a [utf8decode] 
and [utf8encode] to turn bytes into characters and back; also it's a 
method that is available now and reuses the existing list objects; and 
it's a method that supports \0 (NUL) characters.

Disadvantages are that it takes more time to convert to C strings and 
back, it takes more space in .pd files, it isn't readable as text in .pd 
files, it takes up to 4 times more space to represent in .pd files, and 
exactly 4 times more space in RAM (in the case that just iso-latin-1 is 
used), and also that you can't make lists of strings like that.

(By the time we can have real strings, we can have nested-lists, and the 
other way around, because they'd use the same mechanisms. whether it's 
better to make them two types or one type, is a good question.)

  _ _ __ ___ _____ ________ _____________ _____________________ ...
| Mathieu Bouchard - tél:+1.514.383.3801 - http://artengine.ca/matju
| Freelance Digital Arts Engineer, Montréal QC Canada


More information about the Pd-dev mailing list