3 ms·
That’s basically borrowed off Ruby. (Which isn’t a bad thing.)
by Doctor_Fegg 5y ago
That’s basically borrowed off Ruby. (Which isn’t a bad thing.)
- kragen 5y agoIt's not that simple. Ruby's Enumerable is a concrete class; Rust's std::iter::Iterator is a trait, which has some aspects in common with Ruby classes and other aspects in common with Python protocols such as the Python iterator protocol. std::iter::Iterator is (primarily, though not in this case) an external iterator like Python iterators, STL iterators, and ranges in C++20 or D, not an internal iterator like (the original version of) Ruby Enumerable. Rust's type-checking strategy is more like ML than like Ruby, Python, C++, or D, while its compilation strategy is more like C++'s or D's compilation strategy than those of Ruby, Python, or ML.
- Zababa 5y agoThe closure syntax is noted in the "influences" page of the language reference: https://doc.rust-lang.org/reference/influences.html https://doc.rust-lang.org/reference/influences.html > Ruby: closure syntax