I know that the debate was essentially
put to rest be Alexandre, but I promised
yesterday that I would explain why I
don't like Patrik's idea.
Here it goes:
0. vast majority of functions taking strings as
arguments contain semantics which is orthogonal
to the encoding used by the strings.
[the exception here are the functions which operate
directly on the strings, but these are a tiny portion]
1. conceptually, we have some string objects.
If we could treat strings as objects, we could have
probably made the encoding a property of the string.
However, we have the particular situation where we know
all strings passed as arguments use the same encoding;
so, we factor that encoding out. Now, where we store it
is a different matter: we can include it in the name of the
function, or we can have it as a parameter. Both methods
have their own advantages, and this has been discussed
before, so I will not rehash it here.
In short, we are dealing with two orthogonal issues here:
-- Win semantics
-- string encodings
That being said, the reason I don't like doing this compile-time
thing is that is computing the cross-product of these orthogonal
things at compile time. Unless the result is small and performance
critical, this is a Bad Thing in my books.
--
Dimi.
--
Dimi.