3 ms·
Self hosting is interesting, but often times I wish that fundamental tools like compilers were not self hosted when the language in question is a high level one
by gameswithgo 6y ago
Self hosting is interesting, but often times I wish that fundamental tools like compilers were not self hosted when the language in question is a high level one with runtime performance limitations. I'd rather have them be as fast as possible.
- capitol_ 6y agoIt also complicates the bootstrapping process, sometimes significantly. I understand that it's important to eat your own dog food, in order to experience the pain points yourself. But sometimes people think of self hosting as a symbol of something (pride maybe), and that's the wrong way to approach a programming problem in my opinion.
- wtetzner 6y agoIn practice, I suspect it's less about pride, and more about practical issues. Bootstrapping means you only need to deal with one language ecosystem, instead of two. And, presumably, the author of the compiler would prefer to write code in their language over some other one.
- wtetzner 6y agoI think it depends. Writing a compiler in a low-level language won't necessarily result in better performance. It can, if you put in enough performance work, of course. But if you want to keep the code simpler, a higher-level language could potentially give better performance, simply because it's easier to share data structures, avoid copying, etc. Additionally, things like immutable persistent maps are a great fit for environments in a compiler, and they are much easier to implement in a language with garbage collection. That said, obviously some high-level languages are still going to be too slow without also putting in a lot of work. I think there's a sweet spot with languages that compile to reasonably fast machine code but are also garbage collected. Languages like OCaml, Go, Haskell. Though I personally wouldn't use Go, but that's for reasons other than performance.