3 ms·
Can you explain this in more detail? I'm not really familiar with Mojo but I can't think of obvious ways in which Rust's semantics (as opposed to syntax) are mo
by ameliaquining 1mo ago
Can you explain this in more detail? I'm not really familiar with Mojo but I can't think of obvious ways in which Rust's semantics (as opposed to syntax) are more functional than C++'s.
- snovymgodym 1mo agoRust's type system is very Haskell/ML inspired, specifically the first class support for algebraic types and pattern matching. Modern C++ has come a long way with typed optionals and variants, but it's very tacked-on and lacks the safety guarantees and ergonomics of a language designed with this paradigm at a fundamental level.
- saghm 1mo agoSo what does this actually translate to in terms of Mojo? Rust has algebraic types and pattern matching, C++ has some specific use cases that are "tacked-on", to use your phrasing, so when the parent comment says that Mojo is what a good C++ would look like, they're saying...it doesn't have algebraic types, or that they're tacked on? It's not clear to me why that would be a selling point, so giving the parent commenter the benefit of the doubt, I don't think this sounds like what they were trying to say.
- snovymgodym 1mo agoI don't know about Mojo. I was just answering "...I can't think of obvious ways in which Rust's semantics (as opposed to syntax) are more functional than C++'s"
- ameliaquining 1mo agoI consider it basically an accident of history that the first non-research languages to support ADTs were functional. (The first language to have them was actually CLU, which was imperative, but it was a research language.) There isn't really anything about ADTs that makes them incompatible with imperative languages.