Re:Scala on LLVM
by natrius on Friday March 04, 2016 @02:36PM
(#11226316)
This is a cool direction. Other than previous Scala knowledge, what are some advantages of using some sort of scala-native over Rust? I've used Scala and I always imagined that I'd use Rust if I wanted something similar without the ecosystem of JVM libraries.
[ Parent
| on HN ]
Re:Scala on LLVM
by whateveracct on Friday March 04, 2016 @03:48PM
(#11226745)
> Other than previous Scala knowledge, what are some advantages of using some sort of scala-native over Rust?
For one, it isn't as low-level as Rust. That can be good or bad for your use-case.
Also, Scala has a bit more expressive type system than Rust so you get that. Scala has scalaz/cats and shapeless which aren't really possible in Rust.
Re:Scala on LLVM
by CheKhovHemingw3 on Friday March 04, 2016 @02:47PM
(#11226397)
Not to forget about Julia http://julialang.org/ and its high-performance JIT compiler.
A comparison with some of Julia's features:
(1) Multiple dispatch: providing ability to define function behavior across many combinations of argument types
Scala has the Cake Pattern
(2) Built-in package manager
SBT, anyone?
(3) Automatic generation of efficient, specialized code for different argument types
Dotty's Linker is on the horizon, https://d-d.me/talks/scaladays2015/#/
Garbage collection (presumably - not sure what implementation they'll use, this is something that really matters for performance and where the JVM gives a big advantage). Higher-kinded types (supposedly coming in Rust eventually, but Scala has them today) and for/yield syntax. Easier closures that support some functional idioms better (made possible by having garbage collection). And even without Java libraries the library ecosystem for Scala is likely bigger than that for Rust.
I think D is closer to Scala than Rust is. D's metaprogramming is quite a bit more advanced than Rust and it has opt-in garbage collection. The type system isn't advanced like Rust, let alone Scala, but it mostly gets the job done. It's like C and Scala had a remarkably pleasant child.