|
From: | Tobia Conforto |
Subject: | Re: [Chicken-users] ditching syntax-case modules for the utf8 egg |
Date: | Tue, 18 Mar 2008 11:53:07 +0100 |
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
[Prev in Thread] | Current Thread | [Next in Thread] |