-
Notifications
You must be signed in to change notification settings - Fork 5.4k
更新20章泛型翻译 #332
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
更新20章泛型翻译 #332
Conversation
术语*混型*随时间的推移好像拥有了无数的含义,但是其最基本的概念是混合多个类的能力,以产生一个可以表示混型中所有类型的类。这往往是你最后的手段,它将使组装多个类变得简单易行。 | ||
混型的价值之一是它们可以将特性和行为一致地应用于多个类之上。如果想在混型类中修改某些东西,作为一种意外的好处,这些修改将会应用于混型所应用的所有类型之上。正由于此,混型有一点*面向方面编程* (AOP) 的味道,而方面经常被建议用来解决混型问题。 | ||
|
||
### C++中的混型 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个混型是什么。。。貌似中文翻译没有这种术语
docs/book/20-Generics.md
Outdated
## 混型 | ||
|
||
术语*混型*随时间的推移好像拥有了无数的含义,但是其最基本的概念是混合多个类的能力,以产生一个可以表示混型中所有类型的类。这往往是你最后的手段,它将使组装多个类变得简单易行。 | ||
混型的价值之一是它们可以将特性和行为一致地应用于多个类之上。如果想在混型类中修改某些东西,作为一种意外的好处,这些修改将会应用于混型所应用的所有类型之上。正由于此,混型有一点*面向方面编程* (AOP) 的味道,而方面经常被建议用来解决混型问题。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AOP 通常翻译为面向切面。
面向方面不太好
docs/book/20-Generics.md
Outdated
|
||
|
||
<!-- Summary: Is Casting Really So Bad? --> | ||
## 泛型的优劣 | ||
## 总结:转型真的如此之糟吗? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
casting 还是用多点字吧「类型转换」
「转型」这种翻译如果不是看原文,,谁能第一个反应出来是 cast
docs/book/20-Generics.md
Outdated
|
||
正如反射解决方案看起来那样优雅,我们必须观察到反射(尽管在Java的最新版本中得到了显着改进)通常比非反射实现要慢,因为在运行时发生了很多事情。 但它不应阻止您尝试这种解决方案,这依然是值得考虑的一点。 | ||
|
||
几乎可以肯定,您会首先使用 Java 8 功能方法,并且只有在解决了特殊需求时才诉诸反射。 这里对 **ApplyTest.java** 进行了重写,以利用 Java 8 的流和函数工具: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
不用您,用「你」
谢谢,收到,会尽快修改,谢谢!混型是沿用的第四版的描述,有这个概念。
…------------------ 原始邮件 ------------------
发件人: "Joe"<[email protected]>;
发送时间: 2019年12月3日(星期二) 上午10:10
收件人: "LingCoder/OnJava8"<[email protected]>;
抄送: "siyuanzhou"<[email protected]>;"Author"<[email protected]>;
主题: Re: [LingCoder/OnJava8] 更新20章泛型翻译 (#332)
@sjsdfg requested changes on this pull request.
In docs/book/20-Generics.md:
> +} +/* Output: +[Hep!, Hep!, Ho!] +Failure2 +*/ +``` + +**Processor** 执行 `process()`,并且可能会抛出具有类型 **E** 的异常。`process()` 的结果存储在 `List<T>resultCollector` 中(这被称为*收集参数*)。**ProcessRunner** 有一个 `processAll()` 方法,它将执行所持有的每个 **Process** 对象,并返回 **resultCollector** 。 +如果不能参数化所抛出的异常,那么由于检查型异常的缘故,将不能编写出这种泛化的代码。 + +## 混型 + +术语*混型*随时间的推移好像拥有了无数的含义,但是其最基本的概念是混合多个类的能力,以产生一个可以表示混型中所有类型的类。这往往是你最后的手段,它将使组装多个类变得简单易行。 +混型的价值之一是它们可以将特性和行为一致地应用于多个类之上。如果想在混型类中修改某些东西,作为一种意外的好处,这些修改将会应用于混型所应用的所有类型之上。正由于此,混型有一点*面向方面编程* (AOP) 的味道,而方面经常被建议用来解决混型问题。 + +### C++中的混型
这个混型是什么。。。貌似中文翻译没有这种术语
In docs/book/20-Generics.md:
> + } + } +} +/* Output: +[Hep!, Hep!, Ho!] +Failure2 +*/ +``` + +**Processor** 执行 `process()`,并且可能会抛出具有类型 **E** 的异常。`process()` 的结果存储在 `List<T>resultCollector` 中(这被称为*收集参数*)。**ProcessRunner** 有一个 `processAll()` 方法,它将执行所持有的每个 **Process** 对象,并返回 **resultCollector** 。 +如果不能参数化所抛出的异常,那么由于检查型异常的缘故,将不能编写出这种泛化的代码。 + +## 混型 + +术语*混型*随时间的推移好像拥有了无数的含义,但是其最基本的概念是混合多个类的能力,以产生一个可以表示混型中所有类型的类。这往往是你最后的手段,它将使组装多个类变得简单易行。 +混型的价值之一是它们可以将特性和行为一致地应用于多个类之上。如果想在混型类中修改某些东西,作为一种意外的好处,这些修改将会应用于混型所应用的所有类型之上。正由于此,混型有一点*面向方面编程* (AOP) 的味道,而方面经常被建议用来解决混型问题。
AOP 通常翻译为面向切面。
面向方面不太好
In docs/book/20-Generics.md:
> <!-- Summary: Is Casting Really So Bad? --> -## 泛型的优劣 +## 总结:转型真的如此之糟吗?
casting 还是用多点字吧「类型转换」
「转型」这种翻译如果不是看原文,,谁能第一个反应出来是 cast
In docs/book/20-Generics.md:
> +import java.util.*; + +public class SimpleQueue<T> implements Iterable<T> { + private LinkedList<T> storage = new LinkedList<>(); + public void add(T t) { storage.offer(t); } + public T get() { return storage.poll(); } + @OverRide + public Iterator<T> iterator() { + return storage.iterator(); + } +} +``` + +正如反射解决方案看起来那样优雅,我们必须观察到反射(尽管在Java的最新版本中得到了显着改进)通常比非反射实现要慢,因为在运行时发生了很多事情。 但它不应阻止您尝试这种解决方案,这依然是值得考虑的一点。 + +几乎可以肯定,您会首先使用 Java 8 功能方法,并且只有在解决了特殊需求时才诉诸反射。 这里对 **ApplyTest.java** 进行了重写,以利用 Java 8 的流和函数工具:
不用您,用「你」
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
#330