Re: Will interest in C++ be revived after the Java fallout?
On Jan 26, 11:13 pm, Joshua Maurice <joshuamaur...@gmail.com> wrote:
On Jan 26, 12:29 pm, Rui Maciel <rui.mac...@gmail.com> wrote:
Regarding the Unicode bit, that is indeed a thorn on C++'s side, and in
C's too. Nonetheless, the new C and C++ standards already incorporates
C's unicode TR.
Links please? I'm curious how bad the support is.
I'm not familiar with the TR, but if I had to do serious text
handling in Unicode in C or C++ (or in Java), I'd probably use
ICU. (I can't be sure; I've never had to do serious text
handling in Unicode. But I've heard good things about it from
people who have used it. And I do know that the native support
in C, C++ and Java is insufficient.)
In short, for any library purporting to supply Unicode "support", I /
want/ at least:
1- Iterators over Unicode strings - one that iterates by encoding
units, one that iterates by unicode code point, and one that takes a
locale and iterates by grapheme clusters.
Agreed. I don't know of a language which has this, however
(except for the one that iterates by encoding units, which seems
to be universally present for one particular encoding format,
chosen by the implementation).
Ideally, too, such iterators would exist for all of the
different Unicode encoding formats (UTF-8, UTF-16 and UTF-32).
2- Actual good collation and normalization support.
The framework is present in C++, although whether a complete
implementation for Unicode is provided depends on the C++
implementation, and the framework is not particularly simple or
convenient to use.
3- Functions to translate encodings from any "commonly" used encoding
to any of the UTF encodings, and vice versa.
Same response as for 2, except that in this case, it's not that
difficult to use.
4- Not implemented by a retarded monkey. An example of an
implementation by a retarded monkey is one using a virtual function
call per encoding unit for translation between encoding.
But you can't get away from a virtual function call per string,
which is what C++'s ctype and codecvt require.
What support C++ provides is through the various locale facets,
and there isn't (at least at present) any requirement that
facets supporting Unicode are provided (although one would
expect it from a QoI point of view). The interface to facets is
a bit twisted, I'm afraid, but I've not seen anything simpler in
other languages.
--
James Kanze