3 Mar 2007 01:57
string overhaul
Ralf Juengling <juenglin <at> cs.pdx.edu>
2007-03-03 00:57:02 GMT
2007-03-03 00:57:02 GMT
Hi, The representation of string objects by the interpreter and by the compiler is different at the moment. For the interpreter it's an object of builtin class STRING and it maintains a pointer to a C-style (null-terminated) string, the compiler stores strings in ubyte storages (with a redundant \0 terminator to be compatible with C functions). It's ugly because the string data is being copied back and forth each time the line of execution crosses the boundary between interpreter and compiled code (it seems). I would like to unify the representation and use storages on both sides. I would introduce a new storage class "character", say, which internally is equivalent to ubyte (a "wide-character" class could be added later), so that strings are still distinguishable from ubyte storages. These character storages would be read-only, but it's conceivable to allow some string functions to work with ubyte storages as well, so that we effectively would have mutable and immutable strings. I haven't really thought that much about it and was wondering if you would go about this differently. Any thoughts? Ralf -------------------------------------------------------------------------(Continue reading)
RSS Feed