Bug 19264 – byCodeUnit should compare with strings

Status
NEW
Severity
enhancement
Priority
P4
Component
phobos
Product
D
Version
D2
Platform
x86
OS
Mac OS X
Creation time
2018-09-25T15:55:38Z
Last change time
2024-12-01T16:34:14Z
Keywords
bootcamp
Assigned to
dcuan17
Creator
Steven Schveighoffer
Moved to GitHub: phobos#9763 →

Comments

Comment #0 by schveiguy — 2018-09-25T15:55:38Z
In order for byCodeUnit to be a near drop-in replacement for strings, it would be nice to have them compare directly with strings. This means, I would expect this to work: assert("hello".byCodeUnit == "hello"); This probably means adding opEquals overloads for everything, which also means adding toHash overloads. I'd say just comparing to the base type should be sufficient, no need for transcoding for comparison.
Comment #1 by schveiguy — 2018-09-25T15:58:05Z
It shouldn't matter the constancy of the original. This should also work: assert("hello".byCodeUnit == "hello".dup.byCodeUnit);
Comment #2 by robert.schadek — 2024-12-01T16:34:14Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/phobos/issues/9763 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB