logoalt Hacker News

stevefolta • yesterday at 6:16 PM • 6 replies • view on HN

Re "c)": No, self-hosting is the biggest temptation, and the worst mistake, for any programming language. It's death to bootstrapping. However, if you do succumb to the temptation to self-host, having a C backend, as Copper does, is probably the best way to handle it.


Replies

p1necone • yesterday at 9:34 PM

I've never really understood the opposition to self-hosting.

As long as:

* Your language is the kind of language that suits compiler development.

and

* You support compiling to C or something so that bootstrapping doesn't involve an opaque binary or compiling 30 different git commits in a row.

What are the downsides exactly?

➕ show 1 reply
ktimespi • yesterday at 6:20 PM

What's the problem with self-hosting? I do imagine it's easier to write a compiler in something like Haskell.

➕ show 1 reply
ivan_gammel • yesterday at 8:27 PM

Self-hosting is a trivial matter if you can roughly map a subset of features of an existing language to your language. Write bootstrap compiler in that language and translator in parallel (as long as you have good AST/LST), run conformance tests on both.

Zak • yesterday at 8:31 PM

As long as one of the backends is something widely available, I don't see a problem. C is a decent option. LLVM IR is another.

jibalt • yesterday at 10:59 PM

This isn't at all true, as proven especially by Zig.

➕ show 1 reply
throwaway894345 • yesterday at 11:15 PM

Why is it harder to bootstrap a self-hosted language than it is to bootstrap a language implemented in C, which itself must be bootstrapped?

Bootstrapping is a one-time cost, but implementing the toolchain in C is a cost everyone has to pay every single time they touch the toolchain source.

➕ show 1 reply