Odd behaviour of std.range

frame frame86 at live.com
Tue Feb 22 17:48:02 UTC 2022


On Tuesday, 22 February 2022 at 17:33:18 UTC, H. S. Teoh wrote:
> On Tue, Feb 22, 2022 at 05:25:18PM +0000, frame via 
> Digitalmars-d-learn wrote:
>> On Tuesday, 22 February 2022 at 13:25:16 UTC, bauss wrote:
>> 
>> > Welcome to the world of auto decoding, D's million dollar 
>> > mistake.
>> 
>> Well, I think it's ok for strings but it shouldn't do it for 
>> simple arrays
> [...]
>
> In D, a string *is* an array. `string` is just an alias for
> `immutable(char)[]`.

I know, but it's also a type that says "this data belongs 
together, characters will not change, it's finalized" and it 
makes sense that it can contain combined bytes for a code point. 
`char[]` is just an array to work with. It should be seen as a 
collection of single characters. If you want auto decoding, use a 
string instead.


More information about the Digitalmars-d-learn mailing list