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

editorial nit: having both UTF16Encode and UTF16Encoding is weird #1863

Closed
bakkot opened this issue Feb 1, 2020 · 3 comments · Fixed by #2014
Closed

editorial nit: having both UTF16Encode and UTF16Encoding is weird #1863

bakkot opened this issue Feb 1, 2020 · 3 comments · Fixed by #2014

Comments

@bakkot
Copy link
Contributor

bakkot commented Feb 1, 2020

Pulling this out of #1552 now that it's merged:

I feel somewhat negatively about having both UTF16Encoding and UTF16Encode (because the names are too similar). Unfortunately I don't have an obviously superior name to suggest. UTF16EncodeText instead of UTF16Encoding, perhaps?

@jmdyck
Copy link
Collaborator

jmdyck commented Feb 1, 2020

To me, UTF16EncodeText suggests the semantics of UTF16Encode (i.e., it operates on text, a sequence of Unicode code points), so would be a confusing rename for UTF16Encoding.

Instead, how about renaming UTF16Encoding as UTF16EncodeCodePoint (since it operates on a single code point)?

Note that any renaming of UTF16Encoding will likely not be as simple as a search-and-replace, because there are uses of the form "the UTF16Encoding of ", which will sound odd we rename it from a noun (gerund) to a verb. (Mind you, invoking an abstract operation via that syntax is unusual to begin with, so it would be nice to make those more conventional.)

@bakkot
Copy link
Contributor Author

bakkot commented Feb 1, 2020

To me, UTF16EncodeText suggests the semantics of UTF16Encode (i.e., it operates on text, a sequence of Unicode code points), so would be a confusing rename for UTF16Encoding.

Sorry, I meant to suggest it as a name for UTF16Encode, yes.

Instead, how about renaming UTF16Encoding as UTF16EncodeCodePoint (since it operates on a single code point)?

Works for me. I am happy with also changing the invocation style for the operation.

@domenic
Copy link
Member

domenic commented Mar 10, 2020

/cc @annevk who I thought had raised this before.

In general in web browser software at least, "encode" in the context of text refers to going from code points to bytes. This isn't really what is done in these operations, which go from code points to code units.

The names I would suggest are UTF16CodePointToCodeUnits and UTF16CodePointsToCodeUnits.

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

Successfully merging a pull request may close this issue.

4 participants