reactjs / react.dev

The React documentation website
https://react.dev/
Creative Commons Attribution 4.0 International
10.99k stars 7.51k forks source link

How to understand the word "taint" in the new APIs taintObjectReference and taintUniqueValue? #6343

Open Yucohny opened 11 months ago

Yucohny commented 11 months ago

When I'm translating the docs reference/react/experimental_taintObjectReference and reference/react/experimental_taintUniqueValue into Chinese, I'm thinking the deep meaning of the word "taint". The explanation of the "taint" is to damage or spoil the quality, or the effect of something bad or unpleasant that spoils the quality, which carries a somewhat negative connotation. However, considering the documentations' description of the APIs, it's difficult to detect any negative sentiment. In terms of meaning, it appears that "taint" simply signifies the marking of something with some special behavior. I understand that Kubernetes has related concepts regarding "taint", but I feel that these two cannot be directly equated. I would like to know how React describes the meaning of "taint"? Thanks a lot.

eps1lon commented 11 months ago

I'd look at how tain checking or related concepts in Computer Science are translated. Does that help?

Yucohny commented 11 months ago

@eps1lon Thanks for you response. In traditional computer science, the meaning of taint may be consistent with its original meaning - taint means the effect of something bad or unpleasant that spoils the quality (as a noun). It is true that it can be understood and translated in this way in the experimental_taintObjectReference document, but it still feels a bit far-fetched. What makes me really confused is that the word taint seems to have a certain negative emotion (in computer science, the term taint is indeed more used in such scenarios), but in the React docs it feels It's less of a negative emotion and more of a neutral meaning.

loveloki commented 11 months ago

The word taint reminds me of dirty.

Dirty is used to set a tag, which marks the state needs update, so it can be updated in future updates, and enables unnecessary updates to be skipped.

So is taint a tag similar to dirty?

It seems to be used to mark the object with special behavior, such as in the taintUniqueValue api, it marks objects which should not be sent to the client?

awxiaoxian2020 commented 11 months ago

The point is that why does React use taint rather than label or mark and so on?

lunaleaps commented 11 months ago

taint offers more insight into why we're tracking certain object/values due to the CS concepts linked. I think to address the question of translation, you can explain its usage as "marking" as you mention. I don't believe the subtle difference between taint and label is something that needs to be emphasized.

Huxpro commented 11 months ago

The point is that why does React use taint rather than label or mark and so on?

It seems like "Taint checking" already has its own Chinese terminologies for us to use according to wiki: https://zh.wikipedia.org/wiki/%E6%B1%A1%E7%82%B9%E6%A3%80%E9%AA%8C

Huxpro commented 11 months ago

What makes me really confused is that the word taint seems to have a certain negative emotion (in computer science, the term taint is indeed more used in such scenarios), but in the React docs it feels It's less of a negative emotion and more of a neutral meaning.

@Yucohny in fact, it IS used for marking something negative (potentially hurting security) and that is the motivation for introducing these APIs

Huxpro commented 11 months ago

taint offers more insight into why we're tracking certain object/values due to the CS concepts linked. I think to address the question of translation, you can explain its usage as "marking" as you mention. I don't believe the subtle difference between taint and label is something that needs to be emphasized.

Hi @lunaleaps, it's been a while ;)

According to the docs and tweets from Seb's and Matt's (e.g. https://x.com/mattcarrollcode/status/1716599758025093546?s=20), the taint API was introduced for security and privacy reasons, notably accessing data in undesirable context. The uses of the term "taint" in React, as well as Computer Science in general (e.g. "taint checking"), are both connotated with its very literal meaning in English: "a trace of bad or undesirable quality or substance", not to mention that it already has a canonical translation in the Chinese programming community: https://zh.wikipedia.org/wiki/%E6%B1%A1%E7%82%B9%E6%A3%80%E9%AA%8C

So I strongly suggest that we should emphasize the intended difference and separate it with much more neutral and generalized words like "mark" or "label".

lunaleaps commented 11 months ago

Sure, that sounds fine to me. I think this is the call of the translator at this point. I do stand by using the terms "label" or "mark" to conceptually explain what taint-checking means here. But for the naming of the actual feature, a more distinguished term makes sense to me!

Also hi @Huxpro!!