Skip to content

(Update scala-for-java-programmers.md) Fix pr#1405 for zh-cn with some polish. #1406

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
Jul 18, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions _zh-cn/tutorials/scala-for-java-programmers.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ Scala 的导入表达式跟 Java 非常像,但更为强大。如第一行,

## 一切都是对象

Scala 是一个纯粹的面向对象语言,这句话的意思是说,*所有东西*都是对象,包括数字、函数。因为 Java 将基本类型 (如 `boolean` 与 `int` ) 跟参照类型分开,而且没有办法像操作变量一样操作函数,从这角度来看 Scala 跟 Java 是不同的
Scala 是一个纯粹的面向对象语言,意即包括数字、函数在内的*一切*都是对象。这跟 Java 不同,因为 Java 的基本类型 (如 `boolean` 与 `int` ) 和引用类型是有区别的
Copy link
Member

Choose a reason for hiding this comment

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

意即包括数字、函数在内的一切都是对象

nit: how about

意即所有ㄧ切都是对象,而這包含了数字和函数

Copy link
Member

Choose a reason for hiding this comment

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

I think 包括数字、函数在内的一切都是对象 is more in line with Chinese customs.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks for the review. I personally prefer to make the translation sound smoother to the target reader, which might lose some words order literally.


### 数字是对象

Expand All @@ -113,7 +113,7 @@ Scala 是一个纯粹的面向对象语言,这句话的意思是说,*所有

### 函数是对象

可能令 Java 程序员更为惊讶的会是,Scala 中函数也是对象。因此,将函数当做对象传递、把它们存入变量、从其他函数返回函数都是可能的。能够像操作变量一样的操作函数这点是*函数式编程*这一非常有趣的程序设计思想的基石之一。
Scala 中的函数也是对象,所以将函数当做对象传递、把它们存入变量、从其他函数返回函数都是可能的。能够像操作变量一样的操作函数这点是*函数式编程*这一非常有趣的程序设计思想的基石之一。

为何把函数当做变量一样的操作会很有用呢,让我们考虑一个定时函数,功能是每秒执行一些动作。我们要怎么将这动作传给它?最直接的便是将这动作视为函数传入。应该有不少程序员对这种简单传递函数的行为很熟悉:通常在用户界面相关的程序上,用来注册一些当事件发生时被调用的回调函数。

Expand Down