3 ms·
> It seems they accepted this sacrifice for some other unimportant feature [writing Go in Go] Writing Go in Go is a huge feature, not an unimportant feature.
by 4ad 11y ago
> It seems they accepted this sacrifice for some other unimportant feature [writing Go in Go]
Writing Go in Go is a huge feature, not an unimportant feature.
Writing the runtime in Go means we write the runtime in a much safer language. We found and fixed lots of bugs just by rewriting the runtime. Everybody, every user benefits from this tremendously.
Writing the runtime in Go means you can have a precise garbage collector. Every user of Go benefits from this tremendously.
Writing the runtime in Go means the runtime implementation becomes in many respects simpler, because there are no longer complex C-Go interactions (the Plan 9-derived C compiler used a slightly different calling convention!). This again reduces bugs and makes debugging easier. Everybody wins.
Writing the runtime in Go means there's one less custom compiler to maintain (no more Plan 9-derived C compiler!). Less maintenance means more time available for more important things. Also this simplifies new ports. Again, everybody wins.
Writing the compiler in Go means you can have a compiler that's not written in a language that sucks for writing compilers. Because writing compilers is now easier and consumes less time, there's more time available for more important things. Everybody wins.
Writing the compiler in Go means you benefit from all the tooling built for Go. This includes source code transformation tools. Automatic refactoring is very easy to do in Go because you have Go parsers in the standard library. This is not merely hypothetical, it's something that's actually used. The end result is that changing the compiler is faster, again allowing more work to be done.
Writing the compiler in Go also means the compiler can eventually become an idiomatic Go program that can be understood by Go programmers instead of being a ken-idiomatic C program that can only be understood by a few people. More people can work on the compiler. More work is being done as we speak, including work that will make generated code much faster. Everybody wins.
Writing the compiler in Go means you don't depend on million of lines of C++ toolchains in order to exist. As a Go compiler writer this has simplified my life a lot. I can compile the Go distribution in under a minute. On my phone. Which is 5 years old. Last time I tried to compile LLVM it died with a compile error after 6 (six!) hours.
Writing the compiler in Go means I can have fun while writing compilers for fun, so you benefit because I write it. Everybody wins.
I've written three compiler targets by now, one in C and two in Go. I don't plan to stop because I like what I am doing, but I'm not sure I would continue to do it if it were still written in C. People benefit from this not only by having more toys to play with, but new ports mean more comprehensive testing and new bugs found. Different platforms exercise different bugs differently, bugs which are present on all platforms.
Also the actual work done on the ports stimulates further refactoring efforts that will make Go even easier to port in the future. Again everybody wins! And it's only because this "unimportant feature" that is not even visible to most users of Go, coupled with the powerful refactoring technology which makes this possible.
- stcredzero 11y agoGolang has managed to replicate a lot of the virtuous things that happened in the early days of Smalltalk, but in a compiled language. (Has a completely different philosophy about debugging, however.)