Graham Fawcett wrote:
Here's another thought. It seems to me that if we were to represent strings as composite values, e.g. a two-slot record whose first slot is an encoding (the symbol 'utf8, or #f for 'byte' encoding), and whose second slot contains the string data, then the various string functions could dispatch on the type, and there would be no need to monkey-patch core string functions to get the desired semantics.

This is more or less how other languages, such as Python, solved the issue. Two kinds of strings, byte and unicode, and overloading a few string operations to have a slightly different meaning when called on either, computing byte length vs. character length.


Tobia


_______________________________________________
Chicken-users mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/chicken-users

Reply via email to