6 ms·
One benefit Swift has over Scala is that it compiles down to LLVM and is statically linked. I still love Scala though, hands-down my favorite language to work w
by Cyph0n 10y ago
One benefit Swift has over Scala is that it compiles down to LLVM and is statically linked. I still love Scala though, hands-down my favorite language to work with.
- paulddraper 10y agoScala compiles to LLVM too. https://github.com/scala-native/scala-native https://github.com/scala-native/scala-native Though it's experimental (and will likely remain that way for a while).
- erichocean 10y agoWoah! That's badass. :)
- Cyph0n 10y agoI am aware of that, but it's not a fair comparison.
- paulddraper 10y agoAlso, most Scala deployments are "statically linked", i.e. all JAR/class files are together.
- Cyph0n 10y agoYes, but you need to bundle a JRE and the Scala library (~5 MB).
- trevor-e 10y agoI don't know a whole lot about any of this, but isn't Swift's library bundled with iOS apps? Or is that for a different purpose, such as iOS being able to run apps that target different versions of Swift?
- stiGGG 10y agoYes, it's because Swift's ABI isn't stable yet.
- pjmlp 10y agoStarting with Java 9 you will be able to trim down the JRE just for your application, with the new introduced linker.
- virtualwhys 10y ago> and will likely remain that way for a while Not so sure, the alt-Scala train is moving fast (i.e. Dotty, Scala Meta, and Scala Native). Scala.js is already production ready; come 2019 I'd consider present day Scala deprecated, replaced by Dotty with Scala.js and Scala Native compile targets. In fact, initial release of the Scala to Dotty Migration Tool[1] is now available It's happening ;-) [1] http://scala-lang.org/blog/2016/10/24/scalafix.html http://scala-lang.org/blog/2016/10/24/scalafix.html
- paulddraper 10y agoI base my statement on that fact that it's basically just a student working on it. Scala.js acquired significant community help because it has some very strong motivation: tons of software is written for browsers, and sans-plugins, browsers only run JS.
- premium-concern 10y agoScala-Native has already a sizable community around it. It got almost 100 PRs shortly after it was published. Is everything perfect? No! Can you write stuff with it and have it work? Absolutely!
- pjmlp 10y agoAny JVM based language can in theory be AOT compiled to native code. There are quite a few commercial JDKs with option to AOT compile to native code. Of course, if one wants to stay in the realm of free, the existing options aren't that great.
- Cyph0n 10y agoIn theory. I've never actually tried Excelsior or any other AOT Java compiler, so I can't comment on that. What I do know is that Swift is free and has first-class support for AOT compilation.
- pjmlp 10y agoI think it was an error from Sun not to offer AOT in addition to JIT, but apparently they were religious against the idea, only offering it on the embedded JDKs. This could have made Java actually relevant on the desktop, ignoring for a second how clueless Sun was about doing good desktop libraries. However with Java 9 you will be able to use the new Java linker and create you own little VM + AOT startup code. So that coupled with the large Java eco-system is already good enough for many of us. Swift does compile to AOT today, but the tooling and libraries outside Apple platforms is almost insignificant, and only good enough for startups willing to bet on it.
- Cyph0n 10y agoThat Java 9 feature would definitely be amazing. I agree, Swift is nowhere near the maturity of the Java ecosystem.
- pjmlp 10y agoThe linker part is described in these JavaONE 2016 talks https://www.youtube.com/channel/UCdDhYMT2USoLdh4SZIsu_1g/search?query=linker https://www.youtube.com/channel/UCdDhYMT2USoLdh4SZIsu_1g/sea...
- 10y ago
- jorgengorg 10y agoCan you explain why this is such a significant benefit? Honest question.
- Cyph0n 10y agoWith Scala, if I want to build a distributable application, I need to bundle a JRE and the Scala library, which means that a "Hello World" installer would be around 30 MB in size. It's bad practice to assume that your user has Java installed. With compiled languages like Go or Swift, that same application now is 2 MB or so. On top this, the application runs natively on the OS since it is compiled to LLVM.
- premium-concern 10y agoSame with Scala.
- Cyph0n 10y agoIf you're talking about the currently very experimental Scala Native, my response is that comparing such a fledgling implementation to languages built from the ground up for AOT compilation and static linking is just silly. If not, please explain.
- premium-concern 10y agoI don't think it is vastly different from Swift. In Scala the language is stable, the std lib is stable and the runtime is being worked on, in Swift the language is changing heavily, the libraries are under development, but the runtime might be slightly ahead. (If one can describe reference counting as "ahead".)