Remix.run Logo
▲ uecker 18 hours ago

What additional cost does it have to implement the toolchain in C? I would say there is some benefit in terms of implicit testing to have a compiler self-hosting. But having a toolchain in C also has real benefits.

▲throwaway894345 12 hours ago | parent [-]

C is a notoriously difficult language to work in. It has no build system, no module system, an anemic standard library with footguns like null terminated strings, loads of undefined behavior, etc. Moreover, and maybe most importantly, the people developing the language have less opportunity to dogfood it.

I’m sure there are benefits to a C toolchain, but the costs overwhelmingly favor self-hosting for many languages.

▲uecker 9 hours ago | parent [-]

We see so much languages being invented, and many of them do active anti-C marketing. But personally, I do not find it difficult to work in and also enjoy it much more than working in many other languages. There are, of course, build systems one can use, they are just not tied to the language - which build systems should not be. I also do not find most UB a problem in practice, many of them can be fixed simply by using the right compiler flags. Some are more difficult to fix, but think the problem is massively exaggerated. One can also use C with a garbage collector, as GCC does (technically it is now C++).

I agree about your dogfooding comment though.

▲throwaway894345 8 hours ago | parent [-]

I like working in C too, but if better C developers than me say they can’t use it safely then I’m not going to think that I somehow can.

And even though I like writing C, the build tooling and the lack of modules system and a bunch of other footguns remain. (And say what you will about language-specific build tools, but they work very well for 99% of cases, and the benefits of the entire ecosystem using the same tool are significant).

Moreover, I want contributors to my language, and the reality is that however much I like C, the intersection of people who want to work on my language and people who like writing C is going to be vanishingly small. If my language is C-like (e.g., Zig) then that intersection will likely be much bigger, but as the target language approaches C, the benefit of using C goes to 0.

▲uecker 8 hours ago | parent [-]

I think the argument that it is too difficult to write safe C misleading. While it is very difficult to write perfectly safe code in C, this seems to be used as explanation for the amount of CVEs we see. But when I look at the CVEs, the code is often terrible! I recently read a study where the authors observed that most of the projects did not compile without warnings when using GCC's analyzer. At the same time, the Rust rewrite of coreutils with more than 100 CVEs does not exactly convince me that the problem is mainly the choice of language.

I agree that there exist many good reasons to make a language self-hosting. Still, I think there also many obvious benefits from using C.