> Rust is actually really unique among imperative languages in its general composability
Can you compare it to some other imperative language? Because I really don't see anything particularly notable in Rust that would give it this property.
I’m mainly comparing to the progeny of C, where the biggest difference is the fact that almost everything is an expression in Rust.
No need for ternary operators. C# unsafe blocks can only appear as statements (so you cannot delegate from a safe to an unsafe constructor, e.g.). C++ cannot return from the middle of an expression.
A related aspect is the type system, which composes with expressions in really interesting ways, so things like constant array sizes can be inferred.
I’m mainly comparing to the progeny of C, where the biggest difference is the fact that almost everything is an expression in Rust.
No need for ternary operators. C# unsafe blocks can only appear as statements (so you cannot delegate from a safe to an unsafe constructor, e.g.). C++ cannot return from the middle of an expression.
A related aspect is the type system, which composes with expressions in really interesting ways, so things like constant array sizes can be inferred.