Skip to content
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

「第十三章」 13.2.2子类型与型变 中的错误 #30

Open
mzji opened this issue Jan 6, 2019 · 3 comments
Open

「第十三章」 13.2.2子类型与型变 中的错误 #30

mzji opened this issue Jan 6, 2019 · 3 comments
Labels
TODO 内容描述错误 内容描述有违事实 待确认 待确认的问题 第十三章 第十三章
Milestone

Comments

@mzji
Copy link

mzji commented Jan 6, 2019

页码与行数

  • 第 492 页
  • 第 11 行

文本或排版错误

Fn(T) -> U 在 T 上是不变,在 U 上是协变。

按照 我测试的结果FnT 上应该是逆变的。

同理,第 494 页第二行,“普通的函数调用,参数是不变”,但实际上也是逆变的:一个类型为 &'a str 的形参永远可以传一个 &'static str 的实参进去。

PS:感觉这里实际上应该用 fn(T) -> Ufn 类型比 Fn trait 更加基础重要一些。
PS2:493 页就写了 PhantomData<fn(T)>T 上是逆变 😂

@ZhangHanDong
Copy link
Owner

@mzji 感谢反馈。我来调研一下。

@acodercat
Copy link

结果如何

@ZhangHanDong
Copy link
Owner

ZhangHanDong commented May 15, 2020

@acodercat 他说的应该是对的,还没抽出时间看这块

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
TODO 内容描述错误 内容描述有违事实 待确认 待确认的问题 第十三章 第十三章
Projects
None yet
Development

No branches or pull requests

3 participants