Why doesn't this work in D2?
schveiguy at yahoo.com
Mon Jun 28 05:35:23 PDT 2010
On Mon, 28 Jun 2010 08:14:12 -0400, Philippe Sigaud
<philippe.sigaud at gmail.com> wrote:
> On Mon, Jun 28, 2010 at 10:56, Jacob Carlborg <doob at me.com> wrote:
> Something to keep in mind: as of 2.04x (.045? maybe), the way UTF-8 /
> is managed was changed. "asd" is an array of immutable(dchar), not
> imutable(char). At least DMD tells me that its element type is 'dchar'.
No, that is not true. It's still an array of immutable(char). The
compiler still sees it as an array of immutable(char). However, std.range
forces the element type of char and wchar to be bidirectional ranges
of dchar. The tests such as isRandomAccessRange and ElementType are
fudged to say string is *not* a random access range, and its element type
is dchar. This was one of Andrei's changes because without such
shoehorning, std.algorithm could possible start shearing off strings that
Whether that was the right decision remains to be seen. I personally
would rather have special ranges that do those things. If I have a string
that's always in English, why do I need to generate the dchars based on
the characters in that array?
More information about the Digitalmars-d-learn