Skip to content

Fix Chinese Translation of the cheatsheet #1223

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 3 commits into from
Nov 28, 2018

Conversation

da-liii
Copy link
Contributor

@da-liii da-liii commented Nov 24, 2018

No description provided.

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

| `for (x <- xs; y <- ys) yield x*y` _等价于_ <br>`xs flatMap {x => ys map {y => x*y}}` | for 表达式: 叉乘 |
|  `for (x <- xs; y <- ys) {`<br>    `println("%d/%d = %.1f".format(x, y, x/y.toFloat))`<br>`}`                     | for 表达式: 不可避免的格式<br>[sprintf-style](http://java.sun.com/javase/6/docs/api/java/util/Formatter.html#syntax) |
| `for (i <- 1 to 5) {`<br> `println(i)`<br>`}` | for 表达式: 包括上边界的遍历 |
| `for (i <- 1 until 5) {`<br> `println(i)`<br>`}` | for 表达式: 忽略上边界的遍历 |
| <span id="pattern_matching" class="h2">模式匹配</span> | |
Copy link
Contributor

Choose a reason for hiding this comment

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

for表达式挺好 👍

Copy link

Choose a reason for hiding this comment

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

我们在《Scala实用指南》里面这样用的,这样比较简单。

| <span class="label success">Good</span> `val x = 5`<br> <span class="label important">Bad</span> `x=6` | 常量 |
|  `var x: Double = 5`                                                                                     | 显式类型 |
| <span id="functions" class="h2">函数</span> | |
|  <span class="label success">Good</span> `def f(x: Int) = { x*x }`<br> <span class="label important">Bad</span> `def f(x: Int)   { x*x }` | 定义函数 <br> 隐藏出错: 不加“=”号将会是一段返回Unit类型的过程,这将会导致意想不到的错误。 |
|  <span class="label success">Good</span> `def f(x: Int) = { x*x }`<br> <span class="label important">Bad</span> `def f(x: Int)   { x*x }` | 定义函数 <br> 潜在风险: 不加“=”号将会是一段返回Unit类型的过程,这将会导致意想不到的错误。 |
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

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.

我觉得 @liufengyun 建议的风险挺好的。风险区别于错误。风险用于那种语法上正确,但是语义上或许不是程序员期望的那种。错误,则是直接无法编译。暂时没有细看,后续可以直接把中文和英文都改了。 @linqing

Copy link
Contributor Author

Choose a reason for hiding this comment

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

这个页面还有很多别的问题,后面慢慢改

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.

@SethTisue This PR LGTM now.

@SethTisue
Copy link
Member

@liufengyun I've sent you an invite to https://github.com/orgs/scala/teams/team-scala/members so you can merge PRs yourself

@liufengyun
Copy link
Contributor

Thanks a lot @SethTisue !

@liufengyun liufengyun merged commit 6663178 into scala:master Nov 28, 2018
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