Compiling vs Transpiling

前端 未结 4 1464
情书的邮戳
情书的邮戳 2020-12-07 12:57

While searching about the difference, I came across these definitions:

Compiling is the general term for taking source code written in one language

4条回答
  •  天涯浪人
    2020-12-07 13:49

    I mostly agree with tapananand answer, but...


    definition

    Words are "made", so they serve a purpose. And this also changes with time.

    We now tend to use transpiler to specify a compiler that translates code into some other code "more similar" to the source one, that what a compiler might do. And is used to differentiate both mostly when both of them are mentioned in the same context (again mostly implying that a transpile language will have to get compiled at least once more)


    examples

    So everything is very subjective. At the time of this writing:

    • Coming from the Java world I could call CoffeeScript/TypeScript transpilers to depict that the resulting code is no more efficient than the original one.
    • CoffeScript documentation says it's a compiler, and babel is a transpiler. The want do say that CoffeeScript, although very similar, is not Javascript. At least not a version of it, as that is what babel produces.
    • Babel calls itself a compiler.

    fazit

    So transpile is at this time very rarely used anymore, and only to tell two compilers apart.

    It will probably dissapear as concept, since compilation is much more complicated than that (same/higher/lower language, version, etc), and the word doesn't seem to be useful anymore ("transpilers" are now ubiquitous)

提交回复
热议问题