4 ms·
1. Transpilers output to another programming language that is typically written by hand by others (so not assembly). 2. Transpilers don’t typically optimize co
by Matheus28 2y ago
1. Transpilers output to another programming language that is typically written by hand by others (so not assembly).
2. Transpilers don’t typically optimize code, leaving those transformations to the compiler of the target language.
3. Compilers will typically have an internal representation (SSA) which they operate on to optimize. Transpilers typically operate on the AST (because they don’t need to do any but the most trivial optimizations).
There are exceptions to the rules but these cover the majority of the reasons on why people make the distinction.
- randomdata 2y ago> the majority of the reasons on why people make the distinction. You have provided some defining properties that might allow for distinction, but you have not given any reasons for why people make a distinction. But perhaps we can suss it out. Given the statement "Borgo compiles to Go", what important information is lost that would be saved if "Borgo transpiles to Go" was used instead?
- Matheus28 2y agoIn that statement, it doesn't really add anything. In the statement "XYZ is a compiler/transpiler", it does. It doesn't hurt to have a word that is more specific than others. Otherwise we should just refer to compilers as an "app" :)
- lolinder 2y agoI don't think anyone here is saying we shouldn't have the word "transpiler" at all, just that "transpiler" is a subcategory of "compiler" and there's no reason for OP to try to correct the title of this story. It reminds me of how my 5-year-old son always corrects me when I tell him to get in the car—"you mean the van!". I have tried to explain to him that a minivan is a kind of car, and he's just about getting it, but it's been a challenge for him to grasp.
- gergo_barany 2y agoWe shouldn't have the word "transpiler" at all.
- Matheus28 2y ago>I don't think anyone here is saying we shouldn't have the word "transpiler" at all This thread chain is in response to jerf's comment "transpiler shouldn't be a word" (simplifying his comment for brevity's sake)
- lolinder 2y agoEh, that's one possible reading, but their actual take is more nuanced than that: > The word "transpiler" propagates the misunderstanding that there is something special about a compiler that emits machine code, that requires some special "compiler" techniques for special "compiler" purposes that are not necessary for "transpiler" purposes because "transpiling" requires a completely different set of techniques. In context of the parent comment I read this to be a reaction to someone insisting that we use "transpiler" instead of "compiler"—more an observation of what is happening here than a call to stop using the word altogether.
- keybored 2y agoSomeone argues that transpiler adds nothing (no nuance) over the original word. And your takeaway is that “I don't think anyone here is saying we shouldn't have the word "transpiler" at all” and that their original post is “more [of] an observation”? Does a person have to be all boorish and say that “you shouldn’t use that word” in order to convince you that they think it’s useless? Anyway this comment (newer than your comment) seems clear enough: https://news.ycombinator.com/item?id=40214781 https://news.ycombinator.com/item?id=40214781 > Ultimately, "compiler" isn't a bright shining line either... I can take anything and shade it down to the point where you might not be sure ("is that a 'compiler' or an 'interpreter'?"), but the "transpiler" term is trying to draw a line where there isn't even a seam in the landscape.
- 2y ago
- randomdata 2y ago> In the statement "XYZ is a compiler/transpiler", it does. Okay. What important information is lost in "XYZ is a compiler" that would be gained in "XYZ is a transpiler"? > It doesn't hurt to have a word that is more specific than others. It can if the intent is not properly understood. And so far I'm not sure we do have that understanding.
- lolinder 2y agoThese differences aren't inherent to transpilers vs compilers, they're mostly the result of the fact that the vast majority of transpilers are less mature than the battle-tested compilers that you're thinking of. The average hobby compiler—regardless of target—doesn't optimize code and works directly on the AST because that's simple to get started with. Most hobby compilers also target some other language rather than LLVM or machine code because that's simple to get started with, so the result is that most transpilers are hobby projects that don't optimize. But there's no reason why a transpiler shouldn't include optimization steps that adapt the output to use code paths that are known to be fast, and a production-grade transpiler typically will include these steps.