Hacker News new | ask | show | jobs
by jsherer 4177 days ago
I'm curious, as the document doesn't mention it, what is the benefit of bootstrapping? Is it primarily to allow future development to happen in the bootstrapped language, instead of the lower-level language (C in this case)? Or is there some other benefit I'm missing?
3 comments

Yep, exactly. We want to write our compiler in Go, now that the language and libraries are good and stable.

It's a process we started more than a year ago: http://golang.org/s/go13compiler

Bootstrapping has the benefit that the whole compiler toolchain can enjoy the usage of the language.

Additionally it is a way to expose the language designers to possible issues in the language, as they will spend more time using it instead of other implementation language, which helps improving its design and tools.

Personally I tend to favour bootstraping, even if it is a little inconvenient when porting to new architectures.

Microsoft found themselves unable to improve the C# language using a compiler written in a lower level language like C/C++ so they've rewritten it in C# to allow further language development and to support more sophisticated language features.

It also has the benefit of the team implementing the language actually dogfooding it, causing natural evolutionary improvements.

I suspect Google is doing this with go for the same reasons.

> It also has the benefit of the team implementing the language actually dogfooding it, causing natural evolutionary improvements.

On the other hand, a big risk is that the language will evolve towards being better at writing compilers, which is a highly idiosyncratic task.

Yes, that is a real risk. I have written about this before. It's much more of a risk at the start, when there are no other sizable programs. Now there are plenty of sizable Go programs, so I am not worried about overfitting to compiler development.
cough OCaml cough

I jest, but, "ha ha only seriously". It's an interesting problem when writing languages in themselves, that you need to try not to make your language great for writing compilers and nothing else!

I don't understand how the compiler's implementation language has any bearing on the design of the language it is trying to compile.

You should be able to write an O'Caml compiler in javascript or a Haskell compiler in C.

Rewriting the compiler in C# has the advantage of now being able to offer the compiler as a service to the C# run-time but not sure I see how it could have affected the design of the language.