Live data from Hacker News

TeaVM – Ahead-of-time transpiler of Java bytecode to JavaScript or WebAssembly

teavm.org

11–20 of 136 posts

Re: TeaVM – Ahead-of-time transpiler of Java bytecode to JavaScript or WebAssembly

#11
post #9
post #3

Compile

I get that we've lost this battle, and some people seem to think there's a useful distinction being made, but man, does the word 'transpile' grate on me.

thank you; some consolation to know it's not just me

does this seems like another instance of the annoying practice in our field of someone giving a name to a thing because they think it's new, though it's not (ie, source-to-source compilers have been around as long as source-to-bytecode compilers)--no need to re-name them

wish they would just stop it and get the hell off my lawn

Re: TeaVM – Ahead-of-time transpiler of Java bytecode to JavaScript or WebAssembly

#12
post #4

For the reverse, I wrote a WASM-to-JVM compiler: https://github.com/cretz/asmble . I think WASM has the ability for us to finally cross the language boundaries without marrying ourselves to C/C++ ABI. But at this early stage, there's no common stdlib for all languages to share.

That's really interesting! How does calling WASM code on the JVM work? And also in addition to a stdlib, maybe a great package management system. Is there a popular crate / maven / npm etc equivalent out there for wasm yet?

There seems to be a good deal of info in the README: https://github.com/cretz/asmble#compilation-details

I haven't dug deeply but it seems from the documentation that the project is trying to do things the 'right' way (mapping instructions to JVM bytecodes at a low level)... as opposed to, say, trying somehow to compile to Java code.

Re: TeaVM – Ahead-of-time transpiler of Java bytecode to JavaScript or WebAssembly

#15
post #14
post #13

In the end, how will this differ from a Java applet?

You don't need to have Java enabled in your browser.

The problem with that is you'll essentially re-download the entire JVM (and libraries) on each page load. If you don't want to use a Java applet, you would need to reimplement GC, JNI, and so on. Java didn't work on the web for a reason.

Re: TeaVM – Ahead-of-time transpiler of Java bytecode to JavaScript or WebAssembly

#16
post #15
post #14

Earlier quoted context omitted.

You don't need to have Java enabled in your browser.

The problem with that is you'll essentially re-download the entire JVM (and libraries) on each page load. If you don't want to use a Java applet, you would need to reimplement GC, JNI, and so on. Java didn't work on the web for a reason.

GC should be available in WASM in the future. And, not all applets needed JNI.

In other words, this is enabling a subset of well behaved applets, while excluding the naughty (or advanced) applets.

Re: TeaVM – Ahead-of-time transpiler of Java bytecode to JavaScript or WebAssembly

#18
post #9
post #3

Compile

I get that we've lost this battle, and some people seem to think there's a useful distinction being made, but man, does the word 'transpile' grate on me.

At the point where we are calling things that compile to assembly "transpilers" I don't think there is any distinction left, much less a useful one. I mean the classic notion of a compiler is a program that turns things into assembly, which is then taken into machine code by an assembler.

I agree with you that we've lost though: no amount of protest is going to make people stop using the word "transpiler".

Re: TeaVM – Ahead-of-time transpiler of Java bytecode to JavaScript or WebAssembly

#19
post #9
post #3

Compile

I get that we've lost this battle, and some people seem to think there's a useful distinction being made, but man, does the word 'transpile' grate on me.

> some people seem to think there's a useful distinction being made

What is that distinction? Excluding the javascript crowd, I doubt this phrase will see extensive use in the field until the term gets properly defined and is meaningfully distinct from the word Compile as used today.

Re: TeaVM – Ahead-of-time transpiler of Java bytecode to JavaScript or WebAssembly

#20
“TeaVM is a primarily web development tool. It’s not for getting your large existing codebase in Java or Kotlin and producing JavaScript.”

“TeaVM is for you, if:

- You are a Java developer and you are going to write web front-end from scratch.

- You already have Java-based backend and want to integrate front-end code tightly into your existing development infrastructure.

- You have some Java back-end code you want to reuse in front-end.

-You are ready to rewrite your code to work with TeaVM.“

http://teavm.org/docs/intro/overview.html

Post reply on HN