4 ms·
That's where Scala shines. I wrote about this here a bit: https://valentin.willscher.de/posts/contextual-syntax/ https://valentin.willscher.de/posts/contextual-
by valenterry 2y ago
That's where Scala shines. I wrote about this here a bit: https://valentin.willscher.de/posts/contextual-syntax/ https://valentin.willscher.de/posts/contextual-syntax/
Rust is heavily inspired by Scala, but I guess achieving something like the examples in my post is difficult. I really hope Rust finds one way or another to make it work. Because simply forbidding everything all the time isn't even the safest way - it drives many people to just avoid it altogether and use unsafe code.
- nine_k 2y agoWhile at it, could you give a few examples that illustrate how Rust was inspired by Scala proper, and not Haskell / SML / OCaml (which also influenced Scala)?
- amelius 2y agoIt says here: https://en.wikipedia.org/wiki/ML_(programming_language) https://en.wikipedia.org/wiki/ML_(programming_language) that ML influenced Rust, Scala, Haskell and OCaml, so that's the common denominator. However, although Rust wants to be an ML style language all the idioms break because there's no GC.
- threeseed 2y agoSo I regularly jump between Scala and Rust and it's more a feeling. In that overall the way option types, pattern matching, FP operations e.g. map/filter, immutability by default and type parameters have been implemented are very similar to Scala. And since these make up a large percentage of the everyday code you write you see the similarity as being larger than maybe it is.
- akkad33 2y agoAll these are just functional features you find in every functional language though. Rust was highly influenced by OCAML and other ML languages
- threeseed 2y agoHence why I said it was a feeling. And I think the fact the overall style of the language e.g. braces, semicolon, method signatures, loop handling is so similar to Scala versus OCaml contributes to this.
- akkad33 2y agoThis page from official Rust website of its influences does not mention Scala. https://doc.rust-lang.org/reference/influences.html https://doc.rust-lang.org/reference/influences.html In fact this is the first time I've seen anyone say Scala influenced Rust let alone "heavily". Seems like a stretch