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

In the Top 10 there are only two languages which are not self-hosted. Swift with C++ and PHP with C.

I know the reasoning for Swift being that it's just not practical at this point reimplementing everything in Swift, but looking at the others it seems to be the norm to self-host your language at some point at least. Is there a reason for this? Is it just a rite of passage or do the maintainers obviously enjoy using the language itself as well?

Some languages chose to go this route right from the start (see Crystal for example), others might (hopefully) pick this up later (I'd love for Swift to be). Does anyone have any insight on this?



Elixir is not (fully) self-hosted either. There's interesting discussion on the mailing list about this: https://groups.google.com/d/msg/elixir-lang-core/K9i3uBSPKZI...


> In the Top 10 there are only two languages which are not self-hosted.

I don't think that is true. Ruby is written in C, Elixir is built on Erlang and Clojure is built-on Java. In fact the only two I know for sure that are fully self-hosted are Crystal and Julia.


Elixir has a little bit of Erlang in the compiler but at this point it would be fairly trivial to replace it with pure elixir, and most of the compiler is elixir already. However, Elixir does compile down to the EVM/BEAM (Erlang Virtual Machine) without using Erlang as a go-through. I'd argue that Elixir is 'mostly self-hosted'.


Actually the Elixir compiler does NOT compile directly down to the BEAM, it generates Erlang AST which is then passed into the Erlang compiler which then generates the BEAM code. So most of the compiler is in Erlang. It also uses a significant amount of the Erlang libraries as a base for its own libraries. So calling it 'mostly self-hosted' is stretching a bit.


Pretty sure that most interpreted languages aren't self-hosted, for obvious reasons.


Rust is self-hosted in that the compiler front-end is written in Rust, but it uses LLVM in the back-end.


In the case of C#, their previous compiler was built in C/C++ and was apparently very hard to work with. Since rewriting in C# itself, named 'Roslyn', they were able to build it with immutable structures, as well as expose the whole API as a regular C# library. Now they are adding new features all the time and the IDE integration is even better.

It's also really powerful for users to just add the lib, and be able to immediately parse any C# solution with the official tools, get semantic info, errors, autocomplete info etc as well as compile scripts. You can get a mini visual studio up and running in a day.

I can even get the source off github, and continue working in my favourite language. I even did this and changed the parser round (removed need for semicolons, make the language whitespace sensitive) just as a learning exercise. It also gave me a bigger appreciation of functional programming, and how one can use immutable data structures when writing a compiler.

Edit: one of the devs even used it to make real time C# [1] ala Bret Victor style.

[1] http://comealive.io/Tracing-Code-Execution-with-Alive/


This is very interesting, thanks! Makes a lot of sense to support tooling like this.


I think many of the languages either depend on LLVM, C, C++ or JVM/Java. The only language I think not dependent on either of those is Go where compiler, runtime, GC, crypto etc are all written Go and some assembly.


Another language not dependent on any of those is Red which is currently written in Rebol & Red/System.

NB. At some point Rebol parts will be replaced by Red so making it self hosted.


I guess some languages are not meant to be used to write compilers. I a certain way it would make sense to not try to self-host your language at all prices. If you do, you may end up adding features that are outside the original philosophy. I feel that we already have enough universal, system languages. Thus, languages that try to tackle very specific problems seem more useful to me.




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

Search: