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

关于对 Iterator 理解的讨论 #9

Open
bdbai opened this issue Jul 28, 2022 · 0 comments
Open

关于对 Iterator 理解的讨论 #9

bdbai opened this issue Jul 28, 2022 · 0 comments

Comments

@bdbai
Copy link

bdbai commented Jul 28, 2022

05-Iterator 一章中提到:

Iterator在函数式编程中是居于最核心的地位。

但事实上 Iterator 的接口设计加上整个 Rust 的计算模型和函数式范式相去甚远。这个灵魂函数 Iterator::next 的第一个参数是 &mut self,实际上在鼓励实现者使用可变的内部状态来进行迭代,事实上很多实现结构也是如此。而函数式的一大特性就是不可变性,这样改变内部状态的做法并不 idiomatic。

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

No branches or pull requests

1 participant