Hacker News new | ask | show | jobs
by maratc 1633 days ago
So Java, Groovy, Scala, Kotlin and Clojure aren't running on x86, nor ARM, nor Apple Silicon?
1 comments

In a lot of ways, yes. Their runtimes are so massive that saying they "run" on any of those architectures is a stretch of what is actually happening at a lower level.
In "a lot of ways", sure, but definitely not by the most common meaning of "program x runs on y architecture", and not the one being used by most people in this thread.

If you ask any random programmer if "Java runs on x86", 99% of them will say either "yes" or "I don't know what x86 is". Similarly, if you ask them "does Kotlin run on the SPARC architecture", they'll say "I don't know" and, if you give them some time to find [1], they'll amend to "no".

To be precise: the meaning being used by most programmers (and here) is "either the compiled binaries, the virtual machine, or the interpreter runs directly on the given architecture" - which clearly excludes MIT Scheme running on Rosetta, just as (to take a less controversial example) the fact that might be able to run the JVM on qemu on SPARC doesn't mean that the JVM runs on SPARC.

Thinking about the various levels of abstraction of VM's and interpreters is a fun exercise in general, but I don't think it's constructive in this particular situation.

[1] https://openjdk.java.net/jeps/381

No, it's not a stretch at all. This is just nerd contrarianism.
Well, let's see. Is there a way for me to run a Java program as native machine code? Or is the code that I'm executing still a runtime that interprets a program?
Yes there is, although it's not in widespread use yet. [1]

For Scala, there is, separately, Scala Native. [2]

Both have ahead-of-time (AOT) compilers that compile down to the target architecture.

[1] https://www.graalvm.org/reference-manual/native-image/ [2] https://github.com/scala-native/scala-native

The vast majority of the programs in the world are written in Javascript, and there's no way for you to "run" them if by that you mean "natively".
> The vast majority of the programs in the world are written in Javascript

Where is this coming from? What about the literal thousands and thousands of programs on your OS right now? Or the thousands of systems that power large corporations that predate JavaScript popularity?

Sure the language is popular right now, but software development has a much longer history than the last 10 years

They’re talking about the web.
I'm comfortable making that distinction. JavaScript isn't executed like normal, native code, so... I still agree.
When the majority of programs in the world can't be "run" according to your definition, you might want to reconsider your definition.
> Is there a way for me to run a Java program as native machine code?

Yes [1].

[1] https://en.wikipedia.org/wiki/GNU_Compiler_for_Java

Depending on code, a quite large fraction of your java code is run as x86 machine code at any times. It hardly gets more native than that.