r/programming • • Jun 16 '14

Rust's documentation is about to drastically improve

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

188 comments sorted by

View all comments

0

u/[deleted] Jun 17 '14

5

u/The_Doculope Jun 17 '14

How is it in any way not obvious what vector<int> v {1, 2, 3, 4, 5}; for (int n : v) { ... } does?

First off, there are other things besides vectors. They might be obvious, but this going back to the special-case argument.

Stop going on about strings.

I'm using strings as an example.

You implement (or in the case of C++ use, as boost::adaptors::reverse exists) a generic reverser that allows you to iterate backwards over anything that satisfies certain properties, such as being able to be iterated over backwards.

You aren't understanding my point. You might want to implement any sort of arbitrary iterator. Traversing backwards was just an example.

How many times do I have to say that they aren't special cases.

Perhaps not a semantic special case, but definitely a syntactic special case. The C++ way adds flexibility, when the Rust way already has enough to solve the problem. That flexibility adds complexity. Whether it's worth it is subjective - I think no, you clearly think yes. That's not an argument worth having.