4 ms·
Sure, not everything is system programming, but Rust has some higher level features that are even missing in languages like JavaScript and Python. Pattern match
by k__ 6y ago
Sure, not everything is system programming, but Rust has some higher level features that are even missing in languages like JavaScript and Python. Pattern matching is very powerful.
I'm not entirely sure, but have the feeling that Rust's "cons" are mostly short term draw backs and the "pros" could be really valuable in the long run.
- sunsetSamurai 6y agoI think there's a proposed pattern matching implementation for javascript in the works.
- steveklabnik 6y agoThere is, and the author of that proposal created it after learning Rust.
- k__ 6y agoThere is also Z https://github.com/z-pattern-matching/z https://github.com/z-pattern-matching/z
- millstone 6y agoConsider a function like getElementById(). This is natural in JS, but a crisis in Rust - what does it return? How do you ensure that your caller doesn't have some unwrapped RefCell on the stack? etc. Broadly speaking, Rust is good at trees and bad at graphs. This implies real tradeoffs, real design decisions. There are many software components that Rust is just not good at, by design.
- palmtree3000 6y agoApparently [1] it returns Option<Element>. [1] https://rustwasm.github.io/wasm-bindgen/api/web_sys/struct.Document.html#method.get_element_by_id https://rustwasm.github.io/wasm-bindgen/api/web_sys/struct.D...
- k__ 6y agoYes, I didn't understand the problem here neither.