[Issue 13829] std.uni.byCodePoint for strings has length
https://issues.dlang.org/show_bug.cgi?id=13829 --- Comment #1 from Marc Schütz --- In case it wasn't clear: For strings and wstrings, determining the actual number of code points is an O(n) operation and should therefore not be available via length at all. The current implementation returns the number of code units, not of code points. --
[Issue 13829] std.uni.byCodePoint for strings has length
https://issues.dlang.org/show_bug.cgi?id=13829 hst...@quickfur.ath.cx changed: What|Removed |Added CC||hst...@quickfur.ath.cx --- Comment #2 from hst...@quickfur.ath.cx --- The documentation of byCodePoint states that it's the identity function when given a range of code points, and currently, strings are ranges of code points (due to autodecoding), so it simply returns the string as-is. Should this be changed so that it returns a wrapper around the string that suppresses .length instead? --
[Issue 13829] std.uni.byCodePoint for strings has length
https://issues.dlang.org/show_bug.cgi?id=13829 Peter Alexander changed: What|Removed |Added CC||peter.alexander...@gmail.co ||m --- Comment #3 from Peter Alexander --- In a perfect world, I think it should return a different range, but it's now a breaking change, and even breaks its documented behaviour. So I'm voting that this shouldn't be fixed. Note: hasLength will still return false. --
[Issue 13829] std.uni.byCodePoint for strings has length
https://issues.dlang.org/show_bug.cgi?id=13829 --- Comment #4 from Marc Schütz --- (In reply to Peter Alexander from comment #3) > In a perfect world, I think it should return a different range, but it's now > a breaking change, and even breaks its documented behaviour. So I'm voting > that this shouldn't be fixed. I strongly disagree with this. The status quo is clearly wrong. --
[Issue 13829] std.uni.byCodePoint for strings has length
https://issues.dlang.org/show_bug.cgi?id=13829 hst...@quickfur.ath.cx changed: What|Removed |Added CC|hst...@quickfur.ath.cx | --
[Issue 13829] std.uni.byCodePoint for strings has length
https://issues.dlang.org/show_bug.cgi?id=13829 Dmitry Olshansky changed: What|Removed |Added Assignee|nob...@puremagic.com|dmitry.o...@gmail.com --
[Issue 13829] std.uni.byCodePoint for strings has length
https://issues.dlang.org/show_bug.cgi?id=13829 --- Comment #5 from Dmitry Olshansky --- (In reply to Peter Alexander from comment #3) > In a perfect world, I think it should return a different range, but it's now > a breaking change, and even breaks its documented behaviour. So I'm voting > that this shouldn't be fixed. > > Note: hasLength will still return false. Let's us not replicate the broken 'string has no length except it does' stuff even more. If the user says byCodePoint he definetely expects a proper range. I'll change the documentation to reflect this. --
[Issue 13829] std.uni.byCodePoint for strings has length
https://issues.dlang.org/show_bug.cgi?id=13829 --- Comment #6 from Dmitry Olshansky --- https://github.com/dlang/phobos/pull/5733 --
[Issue 13829] std.uni.byCodePoint for strings has length
https://issues.dlang.org/show_bug.cgi?id=13829 --- Comment #7 from github-bugzi...@puremagic.com --- Commits pushed to master at https://github.com/dlang/phobos https://github.com/dlang/phobos/commit/d46bd62bcaa080ea1bfa19fc8d80359226f304a6 Fix issue 13829 - byCodePoint has length https://github.com/dlang/phobos/commit/4cc17371b0994fe5aa494b800105dcae30ada674 Merge pull request #5733 from DmitryOlshansky/fix-issue-13829 Fix issue 13829 - byCodePoint has length merged-on-behalf-of: Dmitry Olshansky --
[Issue 13829] std.uni.byCodePoint for strings has length
https://issues.dlang.org/show_bug.cgi?id=13829 --- Comment #8 from github-bugzi...@puremagic.com --- Commits pushed to stable at https://github.com/dlang/phobos https://github.com/dlang/phobos/commit/d46bd62bcaa080ea1bfa19fc8d80359226f304a6 Fix issue 13829 - byCodePoint has length https://github.com/dlang/phobos/commit/4cc17371b0994fe5aa494b800105dcae30ada674 Merge pull request #5733 from DmitryOlshansky/fix-issue-13829 --