Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The only language I can think of that has pulled off “compiles to another totaling language” and gained mainstream adoption is typescript, and I’m sure it wouldn’t have done so if it were possible to run in the browser otherwise.

Can anyone think of another example?



C++ is for sure gonna be the biggest example. I think Objective-C too.

There's other successful but not "mainstream" languages that might count or semi-count, like Clojure targeting the JVM (though not Java) and being able to use Java packages, or ClojureScript targeting JavaScript.


There’s web2c which transpiles Pascal-Web to C code. And in the 90s, Eberhard Mattes, to enable his port of TeX and friends to OS/2 and DOS wrote a Pascal to C compiler (I remember when it was first released, there was speculation that it might have been a pirated commercial implementation because how could one guy manage this, but that was short-lived as people realized it was faster than any of the commercial versions.)


CoffeeScript was pretty popular about 10 years ago and did this.


Nim compiles to C by default, and it seems most Nim devs stick with that default. Nim hasn’t gained mainstream adoption, though.


haxe is not quite "mainstream adoption" level but it has a decent amount of stuff done in it

clojurescript is fairly popular too.


I like your take but - not that this was important to TypeScript - JavaScript was literally the assembly language of the web (asm.js) until WASM came along. There was no other target that TypeScript could compile to. I guess that’s why TypeScript simply added types to JS, rather than being a wholly new language, which in turn made it compatible and familiar to potential adopters. It also solved a big problem caused by the growing size of client code bases.

All of that said - this train of thought lead me to discover AssemblyScript! https://www.assemblyscript.org/


Not exactly the same but a few languages compile to llir which then is compiled by llvm to machine code.


Elixir compiles to Erlang, I think.


Not exactly correct, it does have "core erlang" as a compilation step, but they both have that as a compilation step ultimately compiling to beam bytecode.


Correct Elixir runs on the BEAN.


C++ used to compile to C.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: