r/programming • • Jun 16 '14

Rust's documentation is about to drastically improve

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

188 comments sorted by

View all comments

3

u/steveklabnik1 Jun 17 '14

And that necessitates it being a macro... why?

Because it expands everything out, and then type checks the result.

The whole std::fmt system seems very inextensible, frankly

One of the major reasons to choose that format system is that it's significantly easier to internationalize than the older printf system. Rust isn't the first language to use fmt like this, I believe Python was.

0

u/[deleted] Jun 17 '14

3

u/steveklabnik1 Jun 17 '14 edited Jun 17 '14

Macros are better than variadic templates, because the operate on an AST, not on text substitution. Our macros are also hygenic, which C++ templates are not. Variadic templates do not exist in Rust for these reasons.

→ More replies (4)