3 ms·
Rust has closures, and they are just a specific implementation of a trait. Many fundamental concepts in Rust, including arithmetic, comparisons, sendability, a
by jdpage 12y ago
Rust has closures, and they are just a specific implementation of a trait.
Many fundamental concepts in Rust, including arithmetic, comparisons, sendability, and smart pointers are formally traits (though the compiler may treat some of them specially, particularly arithmetic and comparisons).
- bjz_ 12y agoThis has been a common theme through Rusts's history. Things that were baked-in language constructs have gradually migrated to become library things with sugar enabled via traits. This is leading to towards a very simple, extensible language.
- Sonata 12y agoThis is something which really excites me about Rust. Having constructs as fundamental as function application extensible via traits reminds me of Python's magic methods, but without the runtime overhead.