Skip to content

Simplify Chinese translation of Scala Tour: self-types.md #1205

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 2 commits into from
Dec 3, 2018

Conversation

realwunan
Copy link
Contributor

Simplify Chinese translation of Scala Tour: Self-type

@@ -13,3 +13,27 @@ language: zh-cn
next-page: implicit-parameters
previous-page: compound-types
---
自类型用于声明一个特质必须混入其他特质,尽管该特质没有直接扩展其他特质。 这使得所依赖的成员可以在没有导入的情况下使用。

自类型是一种缩小 `this` 类型或 `this` 别名类型的方法。 语法看起来像普通函数语法,但是意义完全不一样。
Copy link
Contributor

Choose a reason for hiding this comment

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

缩小 -> 细化/强化? 我感觉强化更好些,WDYT @realwunan

Copy link
Contributor

Choose a reason for hiding this comment

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

thisthis 别名之类型的方法

WDYT?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

缩小 -> 细化/强化? 我感觉强化更好些,WDYT @realwunan

个人觉得细化更好些,英文原文用的是 narrow ,并且自类型确实限定了应该混入的类型

}

trait Tweeter {
this: User => // 重新分配 this 的类型
Copy link
Contributor

Choose a reason for hiding this comment

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

重新赋予

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks a lot.

@liufengyun
Copy link
Contributor

Thanks a lot @realwunan 🎉

@liufengyun liufengyun merged commit 8acb312 into scala:master Dec 3, 2018
@realwunan realwunan deleted the self-types branch December 4, 2018 02:54
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.

2 participants