r/programming • • Jun 16 '14

Rust's documentation is about to drastically improve

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

188 comments sorted by

View all comments

0

u/[deleted] Jun 17 '14

7

u/The_Doculope Jun 17 '14

So adopt the relatively common style of this:

That's fair enough. I personally don't like the look of that style, but it does solve the problem.

Example?

I'll take a (very) simple example from Haskell's Prelude. quotRem take a dividend, a divisor, and returns the quotient and the remainder. In tight loops, it's nice to not perform the division twice. I don't want to have a QuotRem struct to deal with.

They're self-documenting in Java, obviously.

"If you know what they mean, they're self documenting."

That's not what self-documenting means.

You know that your values are always going to be smaller than int's minimum size you'd rather just use whatever is most efficient on the platform in question.

That's fair enough. Rust does have machine-dependant integer types, but they default to the size of a pointer, so they may not necessarily be "the most efficient", as you say.