Skip to content

Instantly share code, notes, and snippets.

@GrabYourPitchforks
Last active March 28, 2021 01:44
Show Gist options
  • Star 13 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save GrabYourPitchforks/b9dbd348b448c938497cff37a3526725 to your computer and use it in GitHub Desktop.
Save GrabYourPitchforks/b9dbd348b448c938497cff37a3526725 to your computer and use it in GitHub Desktop.
Using Rune
@Serentty
Copy link

Serentty commented Jan 17, 2020

I think this is a very good write-up. There's one aspect that I disagree with however, and that's the recommendation to use char instead when you're sure that the character will be representable as a single UTF-16 code unit. I think this is an unnecessary complication to the mental model, and also makes it harder to switch the backing encoding of a string (say, to a Utf8String) without breaking code. I think that going forward, it makes more sense to avoid treating char as an entire character, even when it is known to be. When searching for a character in a string, users shouldn't have to look up whether or not that character is in the BMP when it is simpler to just use Rune.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment