<br><br><div class="gmail_quote">On Mon, Jun 28, 2010 at 14:35, Steven Schveighoffer <span dir="ltr"><<a href="mailto:schveiguy@yahoo.com">schveiguy@yahoo.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div class="im">On Mon, 28 Jun 2010 08:14:12 -0400, Philippe Sigaud <<a href="mailto:philippe.sigaud@gmail.com" target="_blank">philippe.sigaud@gmail.com</a>> wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
On Mon, Jun 28, 2010 at 10:56, Jacob Carlborg <<a href="mailto:doob@me.com" target="_blank">doob@me.com</a>> wrote:<br>
<br>
Something to keep in mind: as of 2.04x (.045? maybe), the way UTF-8 / UTF-32<br>
is managed was changed. "asd" is an array of immutable(dchar), not<br>
imutable(char). At least DMD tells me that its element type is 'dchar'.<br>
</blockquote>
<br></div>
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 weren't valid.<br>
</blockquote><div><br><br>Ah yes, indeed, you're right.<br><br> </div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
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?<br>
<br></blockquote><div><br>All that I can say is that it instantly broke dozens of unit tests in my projects, which were using strings a simple random-access ranges. It took me 2 DMD releases to work my way uout of it.<br>
<br>Maybe I should have a look at byCodeUnit or somesuch. But for clueless users like me, strings suddenly became much more complicated to use. Maybe I was using them in unsafe ways, I don't know. I just hope for a way to get my simple strings back.<br>
<br><br></div></div>