Skip to content

[zh-cn]add reflect tags #1783

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

Merged
merged 5 commits into from
Oct 19, 2020
Merged

[zh-cn]add reflect tags #1783

merged 5 commits into from
Oct 19, 2020

Conversation

jxnu-liguobin
Copy link
Member

This is a draft, any proposed changes will be resolved.

@eed3si9n
Copy link
Member

@jxnu-liguobin Thanks for the contribution!

I can't review this myself so could you find someone who can? /cc @scala/docs-zh

Copy link
Contributor

@liufengyun liufengyun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Otherwise, LGTM 👍

Scala类型的完整类型描述符。例如,`TypeTag[List[String]]`包含所有类型信息,在本例中是类型`scala.List[String]`。

2. `scala.reflect.ClassTag`。
Scala类型的部分类型描述符。例如,`ClassTag[List[String]]`只包含已删除的类类型信息,在本例中为`scala.collection.immutable.List`。`ClassTag`只提供对类型的运行时类的访问。类似于`scala.reflect.ClassManifest`。
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Scala类型的部分类型描述符。例如,`ClassTag[List[String]]`只包含已删除的类类型信息,在本例中为`scala.collection.immutable.List``ClassTag`只提供对类型的运行时类的访问。类似于`scala.reflect.ClassManifest`
Scala类型的部分类型描述符。例如,`ClassTag[List[String]]`只包含已擦除、关于类的类型信息,在本例中为`scala.collection.immutable.List``ClassTag`只提供对类型的运行时类的访问,其类似于`scala.reflect.ClassManifest`


### 使用类型为`TypeTag[T]`、`ClassTag[T]`或`WeakTypeTag[T]`的隐式参数

与`Manifest`一样,实际上可以 _请求_ 编译器生成`TypeTag`。这只需指定一个类型为`TypeTag[T]`的隐式 _票据_ 参数即可完成。如果编译器在隐式搜索期间找不到匹配的隐式值,它将自动生成一个`TypeTag[T]`。
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
`Manifest`一样,实际上可以 _请求_ 编译器生成`TypeTag`。这只需指定一个类型为`TypeTag[T]`的隐式 _票据_ 参数即可完成。如果编译器在隐式搜索期间找不到匹配的隐式值,它将自动生成一个`TypeTag[T]`
`Manifest`一样,实际上可以 _请求_ 编译器生成`TypeTag`。这只需指定一个类型为`TypeTag[T]`的隐式 _例证_ 参数即可完成。如果编译器在隐式搜索期间找不到匹配的隐式值,它将自动生成一个`TypeTag[T]`

/cc @scala/docs-zh evidence的翻译我不晓得有没有标准的译法。我建议翻译为“例证”。

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the original sentence? I'd say use 证据

Copy link
Member

@eed3si9n eed3si9n Sep 25, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As with Manifests, one can in effect request that the compiler generate a
TypeTag. This is done by simply specifying an implicit evidence parameter
of type TypeTag[T]. If the compiler fails to find a matching implicit value
during implicit search, it will automatically generate a TypeTag[T].

In other words, it's using using the term evidence as a metaphor of typeclass instance. In Haskell for example this may come up as a phrase equality evidence. How would you say that in Chinese? I feel like (相等的)证据 fits better than others?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

“例证” has the connotation that it's an instance of possible proofs. But I agree 证据 might be easier to understand than inventing a new technical term.

@jxnu-liguobin
Copy link
Member Author

I also think the 证据 is good. However, additional explanation may be required.

@SethTisue
Copy link
Member

thank you!

@SethTisue SethTisue merged commit 2df8764 into scala:master Oct 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants