Live data from Hacker News

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

teavm.org

81–90 of 136 posts

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

#82
post #66

I think, by now "transpile" just means "compile, but in web development". Because, as we all know, web development you never compile things... /s

very cute, i like your sarc. for those who aren't familiar with transpiling, in this case it's kind of a legitimate use of the term: taking one flavor of compiled code (java bytecode, binary stuff that runs on a jvm) and translating that directly to another type of compiled code (wasm, binary stuff that runs in a browser)

That is actually what compilation means.

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

#83
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…

> 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...).

> For example, “Transpile Java Bytecode to WebAssembly” adds exactly zero information to “Compile Java Bytecode to WebAssembly”

No, the point is that ‘transpile’ more narrowly defines the action being undertaken. While all transpiling is a form of compiling, the reverse is jot true. Specifically from the second definition you cited transpiling connotes that a similar level of abstraction is retained. Often this means that type level information is retained. It’s similar to the distinction of lossy vs lossless compression.

So yes, when I read “X is transpiled to Y” that infers that a certain level of abstraction is maintiained which is not necessarily the case. You can transpile say OCaml to JavaScript and use the garbage collection and native JS types or you can compile OCaml to a JavaScript using a subset of it such as ASM.js using byte arrays and loose type information in he target language. That’s different.

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

#84
I read some parts of the spec of WebAssembly recently, and there were several things that disappointed me. To name a few:

1) There is no way to allocate in a function's variable stack continuous memory space that spans more than 8 bytes. This implies that if a function has as a local variable compound data structure such as an array or a struct, you have to a) have a global virtual stack pointer, b) manipulate the stack pointer to allocate space for the data structure in the virtual stack on the memory, c) read from or write to the allocated memory space, and finally d) restore the stack pointer before the function exits. This is exactly like what resulting assembly code of C compiler does. Why do we have function locals as a WASM primitive, then, if we have to end up with manipulating the stack pointer?

2) Currently a function can only return one value even though it is trivial to add support to mutiple return values taking advantage of the fact that WASM is stack-based. And what puzzles me is that mutiple return values is actually mentioned as a possible feature in the future, in several places in the spec. WASM reached the MVP before adding it, which means that we will have to stick with one-return-value functions for quite a long time even if it is added in the future.

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

#85
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…

[deleted]

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

#86
post #66

I think, by now "transpile" just means "compile, but in web development". Because, as we all know, web development you never compile things... /s

What is the difference between cross-compile and transpile? (Honest question, no sarcasm)

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

#87
post #30

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

I always understood it as this

Transpilation: text to text (eg: Scheme to C)

Compilation: anything to anything but usually it implies text to binary code

transpilation is compilation but compilation is not necessary transpilation (the all squares are rectangles but all rectangles ...)

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

#88

Earlier quoted context omitted.

very cute, i like your sarc. for those who aren't familiar with transpiling, in this case it's kind of a legitimate use of the term: taking one flavor of compiled code (java bytecode, binary stuff that runs on a jvm) and translating that directly to another type of compiled code (wasm, binary stuff that runs in a browser)

That is actually what compilation means.

They're both bytecodes though? I don't see how that is compilation.

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

#89
post #78
post #17

Earlier quoted context omitted.

Agreed especially given that "transpile" lacks a well-defined meaning. Just ask folks how this term differentiates from Compile and you'll get wildly varying answers and definitions.

I think it's pretty clear that "transpile" is a subset of "compile" and that there are both examples of "compile" that are indisputably not "transpile" (plain old source to architecture specific binary) and examples of "compile" that anybody who uses the term "transpile" would include in their personal variety of "transpile" (translation between source formats that are commonly used for human written code). I don't s…

At the time of this reply, there are at least five competing definitions being argued for and against in this thread; some either requiring that the input and output be machine code or disallowing it, some necessitating that both input and output be at "the same level of abstraction" and others arguing that inputs and output can be at different levels of abstraction.

Given the large inconsistency and incompatibility between all these definitions and the existence of a well-accepted term that comprises all of these definitions, is it a mystery why people question the utility of the term? After all, what use is a nuanced term if it can't reliably convey that additional information.

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

#90

Earlier quoted context omitted.

very cute, i like your sarc. for those who aren't familiar with transpiling, in this case it's kind of a legitimate use of the term: taking one flavor of compiled code (java bytecode, binary stuff that runs on a jvm) and translating that directly to another type of compiled code (wasm, binary stuff that runs in a browser)

That is actually what compilation means.

That would be recursive:

"Compilation means taking one type of compiled code and translating it into another type of compiled code."

Post reply on HN