Major performance problem with std.array.front()

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Sat Mar 8 15:50:43 PST 2014


On 3/8/14, 1:15 PM, Walter Bright wrote:
> On 3/8/2014 12:09 AM, Dmitry Olshansky wrote:
>> Becasue Graphemes do not auto-magically convert to dchar and back?
>> After all
>> they are just small strings.
>
> std.uni.Grapheme is a struct, and that struct contains a string of
> arbitrary length.
>
> I don't know if that is the right design or not, or if a Grapheme should
> instead be an alias for a slice (rather than be a distinct type).

I think basic encapsulation suggests Grapheme should be a distinct type. 
It's a restricted slice, not just any slice.

> Graphemes do not appear to have a 1:1 mapping with dchars, and any
> attempt to do so would likely be a giant mistake.

I think they may be comparable to dchar.


Andrei



More information about the Digitalmars-d mailing list