-
Notifications
You must be signed in to change notification settings - Fork 8
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
rename hooks #13
Comments
toString and toValue coerce already, so I'd say it wouldn't be confusing and that the precedent is very clear; however, |
landed as |
|
They’re all English words, including map and to - why is coerce (a common PLT term) unfriendly? |
@ljharb Though "coerce" is a common PLT term, it seems it's very rarely been used in API name. At least not in JS. |
"Type coercion" is a pretty well-known concept, isn't it? |
@ljharb Yes it may be a pretty well-known concept, but it doesn't mean the programmers have to know the English word "coercion" for this concept. I can only tell what most Chinese programmers do. Obviously we communicate with each other mainly in Chinese 😛 , with some technical terms in English. Whether a concept mostly expressed in English word or Chinese translation depends. As my experience, we rarely use English words "coerce", "coercion", instead we use more general word "转换"(convert) "转型"(type conversion) in the context. Note there is no 1:1 term mapping in this case, for example "casting" could also be translated to "转型". There may be several factors. As my previous comment, "coerce" is not in the CET vocabulary, which means most Chinese people with bachelor degree (except those major in English) or below have never learn the word "coerce" in school. Use myself as a example, even I know the word "coerce" I just found that I never really sure how to pronounce it 😝 , which prove that I never use it in daily communication before... On the other hand, if a word is used as a keyword or in the API name, the programmers have to learn it and say it in daily communication. Unfortunately "coerce" is not that case, at least not before this proposal. |
The other factor, the concept of "coerce" may be not as clear as we thought. See "What is the difference between casting and coercing?" on stackoverflow. The top ranked answer say:
As such explanation, The interesting part of it is, the question has tag "C#", and ECMA-335 CLI standard already have official explanation of them, but the top ranked answers still deviate from it. |
I think agreeing on a name is fine, @hax & @bakkot could you discuss things since |
While I'm still not a fan of In the spirit of suggesting names, how do you all feel about |
I feel
Could somebody first help me to understand the problem of |
My problem with it is that there are other things that such an operation might plausibly do which we might someday want to introduce into the language. For example, the first time I saw this proposal I assumed it would work like a combination of the I would ideally like to find a name which makes it clear that this operation is not that one: that this is about transforming the user-exposed representation of the data in the map, not just the value used by the underlying data store. I don't think |
Ok, I understand your concern now, but I doubt changing name from |
The names
toKey
/toValue
might be confusing if we ad an identity/equality hook in the future.Calling these
coerceKey
andcoerceValue
likely is acceptable.The text was updated successfully, but these errors were encountered: