172 points · by epenn · 13y ago · 50 comments
The most exciting user-visible change this time around is almost certainly the new iterator libraries. See the several links in the detailed release notes for more context, but this is such a good resource that I can't resist linking it again here: http://journal.stuffwithstuff.com/2013/01/13/iteration-insid...
EDIT: a link to the actual release announcement itself: http://thread.gmane.org/gmane.comp.lang.rust.devel/4596
> As far as I can tell, you simply can’t solve [the interleave example problem] using internal iterators unless you’re willing to reach for some heavy weaponry like threads or continuations.
I must be missing something, because it doesn't seem particularly hard:
class Array
def interleave_each(other)
self.zip(other).each do | a, b |
yield a if a
yield b if b
end
end
end
Am I cheating somehow, or have I misunderstood the problem?Edit: Ah, I see, the problem is that I'm relying on the specific semantics of lists, which works for the example as written, but not for the general case (ie. if I have one file and one list).
You can derive "internal" iterators using Traversable but it's not like zip is difficult to implement.
[1] http://pcwalton.github.io/blog/2013/06/02/removing-garbage-c...
However, Rust really needs Windows-savvy developers! If you can help, please do.
Seems like there are a few straightforward "fixables" in there.
"Does it run on Windows?
Yes. All development happens in lock-step on all 3 target platforms. Using MinGW, not Cygwin. Note that the windows implementation currently has some limitations: in particular tasks cannot unwind on windows, and all Rust executables require a MinGW installation at runtime."
EDIT: DASD above says "all Rust executables require a MinGW installation at runtime."
`Option<~T>` is now represented as a nullable pointer.
Does that mean they introduced more prevalent nulls into the language? that seems like a shockingly bad choiceEDIT: And if you're referring to the way that our iterators automatically guarantee that iterator invalidation just can't happen, well, that's simply how borrowed pointers work! No extra effort required (not that borrowed pointers are the easiest thing to grok in the first place, mind you...).
(Edit: I should point out C# is not the only platform that gets this wrong. C++/STL has the same design.)
The Option type in Rust is incredibly cheap compared to the equivalent struct or class in C#.
I'll happily admit Rust's more efficient, though.
[1]: http://www.urbandictionary.com/define.php?term=Is+it+soup+ye...
Here's a page with some of the projects I know off the top of my head: https://github.com/mozilla/rust/wiki/Projects-using-Rust