[Issue 10543] std.algorithm.map incorrectly uses source range length for narrow strings

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Jul 4 10:54:47 PDT 2013


http://d.puremagic.com/issues/show_bug.cgi?id=10543



--- Comment #5 from Peter Alexander <peter.alexander.au at gmail.com> 2013-07-04 10:54:42 PDT ---
(In reply to comment #4)
> 21 is the number of UTF-8 code units.
> Using dstring produces 7.

I am not requesting the length of the string, I am requesting the length of the
map over the string. As ranges, strings are ranges of code points, not code
units, so the number of elements in the *map* (confirmed by the output) is
seven, i.e. that is the number of times you can safely call popFront on the
map.

I'm struggling to understand the confusion.

m is a range of seven integers
m.length is 21
walkLength(m) is also 21

This is completely broken.

I fully understand that narrow strings use length to report code units, not
code points, but m is not a string, so that distinction does not apply.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list