4 ms·
I'm trying Rust for the same reason why I'm investing weeks into learning Clojure. Because I'm convinced learning more approaches to high-level problems (like o
by danieljh 12y ago
I'm trying Rust for the same reason why I'm investing weeks into learning Clojure. Because I'm convinced learning more approaches to high-level problems (like ownership, concurrency, typing, patterns) is one way to improve my overall skill set and thinking.
One thing I like about Rust is how you e.g. can specify a Sortable trait and then with T: Sortable require it for types.
This will eventually come to C++ with Concepts (lite), for now there are ways to work around this, e.g. with:
#define requires(...) typename enable_if<(__VA_ARGS__), int>::type = 0
template <typename T, requires(is_integral<T>())>
void fn(T);
Without a feature like this you may see cryptic errors from inside template instantiations coming from your stdlib, when you try to sort something that is not sortable.