News for hackers. Stuff that matters.
Re:Server APIs Project by Cyph0n on Tuesday October 25, 2016 @04:20PM (#12791311)
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.
Re:Server APIs Project by paulddraper on Tuesday October 25, 2016 @05:25PM (#12791768)
Scala compiles to LLVM too.

https://github.com/scala-native/scala-native

Though it's experimental (and will likely remain that way for a while).

Re:Server APIs Project by virtualwhys on Wednesday October 26, 2016 @12:47AM (#12793939)
> 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

Re:Server APIs Project by paulddraper on Wednesday October 26, 2016 @12:56PM (#12798179)
I 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.

Re:Server APIs Project by premium-concern on Wednesday October 26, 2016 @06:11PM (#12801144)
Scala-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!

Re:Server APIs Project by erichocean on Tuesday October 25, 2016 @05:42PM (#12791929)
Woah! That's badass. :)
Re:Server APIs Project by Cyph0n on Tuesday October 25, 2016 @07:13PM (#12792613)
I am aware of that, but it's not a fair comparison.
Re:Server APIs Project by paulddraper on Tuesday October 25, 2016 @07:18PM (#12792640)
Also, most Scala deployments are "statically linked", i.e. all JAR/class files are together.
Re:Server APIs Project by Cyph0n on Tuesday October 25, 2016 @07:23PM (#12792662)
Yes, but you need to bundle a JRE and the Scala library (~5 MB).
Re:Server APIs Project by trevor-e on Wednesday October 26, 2016 @12:18AM (#12793845)
I 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?
Re:Server APIs Project by stiGGG on Wednesday October 26, 2016 @03:48AM (#12794665)
Yes, it's because Swift's ABI isn't stable yet.
Re:Server APIs Project by pjmlp on Wednesday October 26, 2016 @06:45AM (#12795413)
Starting with Java 9 you will be able to trim down the JRE just for your application, with the new introduced linker.
Re:Server APIs Project by pjmlp on Tuesday October 25, 2016 @06:06PM (#12792156)
Any 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.

Re:Server APIs Project by Cyph0n on Tuesday October 25, 2016 @07:27PM (#12792691)
In 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.
Re:Server APIs Project by pjmlp on Wednesday October 26, 2016 @03:43AM (#12794647)
I 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.

Re:Server APIs Project by Cyph0n on Wednesday October 26, 2016 @12:35PM (#12797925)
That Java 9 feature would definitely be amazing. I agree, Swift is nowhere near the maturity of the Java ecosystem.
Re:Server APIs Project by pjmlp on Wednesday October 26, 2016 @01:38PM (#12798610)
The linker part is described in these JavaONE 2016 talks

https://www.youtube.com/channel/UCdDhYMT2USoLdh4SZIsu_1g/sea...

Re:Server APIs Project by Cyph0n on Wednesday October 26, 2016 @05:43PM (#12800916)
Thanks for that. Are you aware of any numbers on the size savings you get for a typical app using jlink?
Re:Server APIs Project by pjmlp on Thursday October 27, 2016 @04:28AM (#12803613)
No, as I am yet to play with it.

So far I only seen the presentations.

But looking at Java 8 on this PC I would say:

jvm.dll (8 MB) + main.exe (200 KB) + trimmed down JRE

Also notice that from the presentations they have some experimental support for jlink plugins, which can further shrink down the size.

Re:Server APIs Project by jorgengorg on Wednesday October 26, 2016 @12:29AM (#12793890)
Can you explain why this is such a significant benefit? Honest question.
Re:Server APIs Project by Cyph0n on Wednesday October 26, 2016 @08:00AM (#12795720)
With 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.

Re:Server APIs Project by premium-concern on Wednesday October 26, 2016 @08:19AM (#12795822)
Same with Scala.
Re:Server APIs Project by Cyph0n on Wednesday October 26, 2016 @08:29AM (#12795881)
If 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.

Re:Server APIs Project by premium-concern on Wednesday October 26, 2016 @08:46AM (#12795978)
I 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".)