Odd behaviour of std.range
frame
frame86 at live.com
Tue Feb 22 17:15:01 UTC 2022
On Tuesday, 22 February 2022 at 12:53:03 UTC, Adam D Ruppe wrote:
> On Tuesday, 22 February 2022 at 12:48:21 UTC, frame wrote:
>> What am I missing here? Is this some UTF conversion issue?
>
> `front` is a phobos function. Phobos treats char as special
> than all other arrays.
Ah, ok. It directly attaches `front` to the string, regardless of
the function. That is the problem.
> It was a naive design flaw that nobody has the courage to fix.
> ... or ask why you're doing range operations on a string in the
> first place and see if the behavior actually kinda makes sense
> for you.
Because I needed a similar function to `tail` that takes care of
the length and even it's trivial to implement it by myself, I
just thought it's better to use a function that is already there.
More information about the Digitalmars-d-learn
mailing list