Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

byCodeUnit should compare with strings #9763

Open
dlangBugzillaToGithub opened this issue Sep 25, 2018 · 1 comment
Open

byCodeUnit should compare with strings #9763

dlangBugzillaToGithub opened this issue Sep 25, 2018 · 1 comment

Comments

@dlangBugzillaToGithub
Copy link

schveiguy (@schveiguy) reported this on 2018-09-25T15:55:38Z

Transfered from https://issues.dlang.org/show_bug.cgi?id=19264

CC List

  • dcuan17
  • edi33416

Description

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.
@dlangBugzillaToGithub
Copy link
Author

schveiguy (@schveiguy) commented on 2018-09-25T15:58:05Z

It shouldn't matter the constancy of the original.

This should also work:

assert("hello".byCodeUnit == "hello".dup.byCodeUnit);

@thewilsonator thewilsonator removed Arch:x86 Issues specific to x86 P4 OS:Mac OS Issues Specific to Mac OS labels Dec 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants