3 ms·
Can we please stop using the verb transpile? Compile is fine, thank you. When it was used only for certain kinds of "shallow" compilation it was bad enough (an
by pron 7y ago
Can we please stop using the verb transpile? Compile is fine, thank you.
When it was used only for certain kinds of "shallow" compilation it was bad enough (and it was really horrible even then), but this article uses it when describing compilation with whole-program analysis and optimization and machine code as the target.
- simongray 7y agoI do apologise. This was written mostly as a stream of consciousness, only stopping to google the github repos.
- pron 7y agoThank you. Also, "referential transparency" doesn't mean what some FP people think it means [1]. Even though no language with macros is referentially transparent [2], Clojure, like all Lisps, is a poster child of referential opacity (opaqueness?), deriving much of its power from it. If you can quote code terms, you can't possibly be transparent with respect to reference (denotation). Saying "pure" or "without side-effects" -- that, while not entirely precise, at least expresses the intended meaning -- is both simpler and better than saying "referentially transparent", which is often just wrong. Anyway, Clojure is great! [1]: https://stackoverflow.com/a/9859966/750563 https://stackoverflow.com/a/9859966/750563 [2]: Sorry Template Haskell, Java is more referentially transparent than you, although the consequences of that are not what those same FP people think, either.
- kreetx 7y agoCould you elaborate on the part on "no language with macros is referentially transparent", specifically, do you mean that if macros can do IO, then the transparency isn't there anymore?
- pron 7y agoIO and side effects have aboslutely nothing to do with referential transparency. A referentially transparent expression is one whose subterms can be replaced with other subterms having the same meaning (reference) without changing the meaning of the expression. Hence, the expression -- a piece of syntax -- is transparent to its reference (denotation, or meaning). Change any piece with another with the same meaning, and the overall meaning is the same. For example, Java is a referentially transparent language. Suppose we have: int x; int f() { x++; return 3; } int g() { x++; return 3; } Then g and f have the same meaning, and in any Java expression, they are interchangeable (the fact they have side-effects is totally irrelevant). This is not true for Clojure and Haskell (template Haskell), which are not referentially transparent, because, e.g. (defn f [] 3) (defn f [] 3) (defmacro foo [x] (str x)) Then (foo f) and (foo g) mean something very different, even though f and g have the same reference, hence the expression (foo ...) is not transparent to its subterms' references, but rather their syntax obscures them. When some FP people say "referential transparency" they actually mean something else altogether. They mean that the meaning of a subroutine application that yields the value 3 is indistinguishable from the value 3. This is, indeed, not true in imperative languages like Java and Clojure, but this is called "value semantics" -- i.e. the meaning of any expression is just a value in the language -- or simply, being pure functional. Then why do they call it "referential transparency"? This has to do with social dynamics in the FP community that is eager to use mathematical-sounding terms but the people don't usually have the requisite mathematical understanding, so like in a game of telephone those terms are quickly used incorrectly and drift away from their correct meaning. Natural language (see example in the link I posted in my previous comment), programming languages with macros and modal logics are not referentially transparent, because referential opacity adds more power to a language (Lisp can express computations that the lambda calculus cannot, thanks to macros). That FP people (who often rely on referential opacity) say referential transparency is a good thing is also a result of a compulsion in that community to take neutral mathematical definitions and assign them moral values. Referential trasnparency has some properties, some of them can be helpful in some circumstances and some can be harmful in other circumstances. In general, however, it is not a particularly important property one way or the other.
- 7thaccount 7y agoThere's absolutely nothing wrong with transpile. Yes compiler covers all sorts of things (code -> assembly or code -> different language code...etc). However when I hear "transpile" I immediately think of a language going to another language like when Nim gets converted to C or JavaScript or when Clojure gets converted to Java first. It is a specific form of compilation right?
- pron 7y agoIt is a rather ill-defined form of compilation; i.e., it's not clear what that form is. Compilation means translation from one language to another; every compiler does that. Transpile was born because people were used to the fact that the target language of many compilers is machine code, but it's entirely unnecessary to have a separate word for that, as it doesn't add any information. There could be a meaningful term for the word, to refer to some sort of "shallow" compiler, that compiles a source language to a target language of a similar level of abstraction and preserves the source code structure in the output, but people often use the word in other cases, too. In other words, transpile and compile are synonymous, making the newer, hybrid word redundant.
- Stratoscope 7y agoHere's a recent comment of mine making a similar point with a couple of citations: https://news.ycombinator.com/item?id=22441298 https://news.ycombinator.com/item?id=22441298
- 7thaccount 7y agoI think this is just the way human language generally works being that it is organic and messy. In my field, there are numerous overlapping and even contradictory terms. I like the added distinction "transpiler" provides as I immediately know what the author means. Or the author could just use the term "compiler" plus another sentence to describe which kind. Transpiler seems like the more efficient way to convey the concept.
- pron 7y ago