2 ms·
I really like the approach of allowing either kind of call, with the "dot" style mere convenience over the function style. Rust has that sort of thing: let
by sanderjd 12y ago
I really like the approach of allowing either kind of call, with the "dot" style mere convenience over the function style. Rust has that sort of thing:
let v = &vec![1u32,2,3];
println!("{}", v.len());
println!("{}", Vec::len(v));
- kibwen 12y agoIn general this feature is sometimes called "Universal Function Call Syntax" (UFCS), though interestingly Rust does it exactly the opposite of most other languages with this feature. In Rust, defining a method lets you use it as a free function; in C# and D, defining a free function lets you use it as a method.