On 1/17/11 5:13 PM, spir wrote:
On 01/17/2011 07:57 PM, Andrei Alexandrescu wrote:
* Line 130: representing a text as a dchar[][] has its advantages but
major efficiency issues. To be frank I think it's a disaster. I think a
representation building on UTF strings directly is bound to be vastly
better.
I don't understand your point. Where is the difference with D's builtin
types, then?
Unfortunately I won't have much time to discuss all these points, but
this is a simple one: using dchar[][] wastes memory and time. You need
to build on a flatter representation. Don't confuse the abstraction you
are building with its underlying representation. The difference between
your abstraction and char[]/wchar[]/dchar[] (which I strongly recommend
you to build on) is that the abstractions offer different, higher-level
primitives that the representation doesn't.
Let me repeat again: if anyone in this community wants to put work in a
forward range that iterates one grapheme at a time, that work would be
very valuable because it will allow us to experiment with graphemes in a
non-disruptive way while benefiting of a host of algorithms. ByGrapheme
and friends will help more than defining new string types.
Andrei