Live data from Hacker News

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

teavm.org

61–70 of 136 posts

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

#61
post #55

Earlier quoted context omitted.

Not new, but as unnecessary as ever.

i find it fascinating how some in a community notoriously anal about 'being precise' want to be less precise, presumably because of some incorrect assumptions about a word. is it because they think it's a neologism? is it because they associate it with javascript developers, who they look down upon and sneer at? the word and idea predates javascript. rather amusing. :)

From a quick Google search, I find mainly two kinds of definitions of "transpile".

The first is a generic "translating from one source programming language to another, producing translated source code in the other language". This is basically compiling, except that it excludes "non-source" languages from the output.

The second, which looks more rigorous to me, is "taking source code written in one language and transforming into another language that has a similar level of abstraction" (found for example here: https://www.stevefenton.co.uk/2012/11/compiling-vs-transpili...).

Both are totally unnecessary because if you mention or know the source and target languages of your compiler, then you already know if it fits those definitions or not.

For example, "Transpile Java Bytecode to WebAssembly" adds exactly zero information to "Compile Java Bytecode to WebAssembly", because the word "transpile" only carries information about the relation between the languages you are processing and that is an already-known variable. As it is every time I see this word.

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

#62
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.

There was a battle? Transpile is between human readable sources, and compiler is always into machine readable code. This is the only project that I've seen to (for some reason) not conform to that definition. I guess I don't see the point of contention.

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

#63
post #55

Earlier quoted context omitted.

i find it fascinating how some in a community notoriously anal about 'being precise' want to be less precise, presumably because of some incorrect assumptions about a word. is it because they think it's a neologism? is it because they associate it with javascript developers, who they look down upon and sneer at? the word and idea predates javascript. rather amusing. :)

From a quick Google search, I find mainly two kinds of definitions of "transpile". The first is a generic "translating from one source programming language to another, producing translated source code in the other language". This is basically compiling, except that it excludes "non-source" languages from the output. The second, which looks more rigorous to me, is "taking source code written in one language and transf…

It may not be semantically required, but redundancy adds emphasis and makes things easier to process.

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

#64

So... from reading the page linked (admitting my ignorance)... I really wonder how useful this is? Not to be rude, or to talk ill of the work, it’s far better than I could do... but! With the release of other ahead of time compilers/VMs/features for the JVM/Java9, I cannot fathom this produces a small enough payload for a web app over a mobile connection. Im probably totally missing something; could someone educate m…

If you are compiling to the JVM the output is probably nothing related to a web app.

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

#65
post #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…

[deleted]

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

#67
post #46
post #34

The last thing we need in hindsight to Meltdown and Spectre is running untrusted binaries in the browser aka WebAssembly. Btw deactivating WebAssembly support in Chrome 63 (up-to-date) doesn't work anymore!! chrome://flags/#enable-webassembly Setting it to "deactivated" does nothing, WebAssembly is still active.

> untrusted binaries afaik, wasm is not 'binaries' in that it's not an arbitrary blob of machine code fed right into the cpu. it's still running in a sandbox (a la javascript) including similar limitations wrt CORS etc.

> it's still running in a sandbox (a la javascript)

People frequently make this comparison upon hearing the term sandbox, but this is a weak comparison. Yes JavaScript executes in a sandbox, but the JavaScript (JIT) sandbox is purely for performance instead of isolation, which is like comparing a pencil sharpener to a bulldozer just because they are both portable machines. A better comparison of the JavaScript (JIT) sandbox is the JVM.

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

#68
post #58
post #54

Earlier quoted context omitted.

The browser would cache that automatically. And in many cases, you'd probably use a Service Worker to implement your own custom cache and "install" the application locally in the browser, so that is usable offline and only version updates are downloaded in the background.

Weren't applets also cached? To be honest, I think that hate of applets comes from a time when 56kbps download speeds were considered very high, the average CPU had 1 core at 200 Mhz and the average webpage weighed 20k and executed 5-10 lines of Javascript. I haven't used applets in the time, but if the user experience would be improved (nice looking UI, respecting modern UX conventions, etc.), I imagine your average…

Not only that, swing applets are notoriously fugly. One reason electron is successful is because it kinda looks like native. Swing Look and Feels all seem alien.

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

#69

So... from reading the page linked (admitting my ignorance)... I really wonder how useful this is? Not to be rude, or to talk ill of the work, it’s far better than I could do... but! With the release of other ahead of time compilers/VMs/features for the JVM/Java9, I cannot fathom this produces a small enough payload for a web app over a mobile connection. Im probably totally missing something; could someone educate m…

If you are compiling to the JVM the output is probably nothing related to a web app.

One isn't compiling to the JVM with this, they're compiling to WebAssembly. And I think the point of this is to compile JVM code to WebAssembly, right? Am I missing something even larger than that?!

Should someone want another VM to run their code in; how, good is this at reducing the size of the std lib or the JVM itself? Can I depend on useful packages with this, or will they immediately shit the bed? Will the payload be something like 150mb?

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

#70
post #32
post #30

That word,"Transpile". Lol. GCC transpiles C to assembly.

I guess it implies a 1-1 or similar conversion without optimizations or multiple levels of intermediate representation. GCC certainly doesn't "transpile" in that case...

So GCC -O0 is a transpiler, but GCC -O3 is a compiler? Nice.
Post reply on HN