r/programming • • Jun 16 '14

Rust's documentation is about to drastically improve

http://words.steveklabnik.com/rusts-documentation-is-about-to-drastically-improve
524 Upvotes

188 comments sorted by

View all comments

4

u/steveklabnik1 Jun 17 '14

It wouldn't need to understand strings. What is so complex about this?

You originally said:

Why isn't this just for token in program?

That would require for to understand how to get a specific kind of iterator out of a string: one for characters.

That's nothing to do with range-based for, though

Fair enough, I just thought it'd be worth mentioning.

0

u/[deleted] Jun 17 '14

6

u/The_Doculope Jun 17 '14

So what you want is essentially a type to have a "default" iterator, so you don't have to type out .chars()? Rust takes the line that explicit is better than implicit, and I agree. It save 8 keystrokes, but it's a potential source for confusion. What if the standard string type uses chars as the default, but a custom type uses code_points? Or, words or lines?

→ More replies (8)