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