by usrusr · 3y ago · 0 comments
I really like the option to "semantically scope" a function to its main subject, like in kotlin extension methods. But I fail to see why I'd ever want to have both options. Is it just a compatibility thing, to be able to call code written for conventional languages? Or from developers who don't like that approach?
let letters = word.chars().filter(|ch| ch.is_alphabetic());
you can just write let letters = word.chars().filter(is_alphabetic);
since the difference between "methods" and "functions" is purely syntactic.