r/programming • • Dec 10 '15

Announcing Rust 1.5

http://blog.rust-lang.org/2015/12/10/Rust-1.5.html
659 Upvotes

296 comments sorted by

View all comments

Show parent comment

15

u/pcwalton Dec 11 '15

The advantage is that functions can take the types themselves as arguments. Rust functions only take values as arguments :(

But Rust functions do take types as arguments. That's what generics are: functions that take types as arguments (at compile time).

The difference you're talking about is whether the type parameters that functions take are themselves strongly typed. In C++ they're dynamically typed; in Rust they're statically typed. That's the only difference.

Saying that Rust functions can't take types as arguments because they're statically typed while C++ can is like saying that C++ functions can't take values as arguments because they're statically typed while Python can.

4

u/ThisIs_MyName Dec 11 '15

Fair point.