Hacker News new | past | comments | ask | show | jobs | submit login

> Clojurescript for frontend, Rust for portability

If Clojure and Rust work well for you, more power to you. But at least in theory, you could very well use just Scala for these purposes

Scala can compile to JS https://www.scala-js.org/ if you target frontend.

And if you want portability, you can compile a Scala program with GraalVM's native-image and statically link everything with musl libc https://www.graalvm.org/latest/reference-manual/native-image...

And if you want both frontend and portability everywhere, Scala will soon have a support for compiling to WASM (with WASI, etc) https://github.com/scala-wasm/scala-wasm/ (to be integrated into Scala.js after developed)




> And if you want portability, you can compile a Scala program with GraalVM's native-image and statically link everything with musl libc

Getting the musl stuff to work can be tricky, mostly-static (only libc dynamically linked) is an easier option.

I've built a CLI diagnostics app with Scala & NativeImage and I've embedded the Graal Python interpreter inside it to allow extension scripts to be written. The result is a zero-install executable that provides an n entire Python environment. I think that's a good showcase for one of Scala's strengths, it's interoperability with the Java ecosystem.


I've been meaning to try scala-js. If anyone care to share their experience with GraalVM's native-image, I'd be interested in hearing that.


> If anyone care to share their experience with GraalVM's native-image, I'd be interested in hearing that.

The main issue is if you are using reflection, which needs metadata adding to describe it so the necessary metadata is included in the image. Some libraries already have it built in, and there are tools to help.

For building, https://github.com/sbt/sbt-assembly supports native Image.


What about GraalVM licensing?

According to https://www.graalvm.org/latest/introduction/#licensing-and-s... the community edition is free software (GPLv2 + classpath exception).

But it isn't really clear what the differences are between the free software version and the proprietary version.

There does not seem to be a page detailing the differences between the two (or at least I couldn't find it)


I think the proprietary variant of GraalVM comes with more optimizations in the compiler.

But the AOT compilation (native-image) is available in the GPL community variant.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: