Post B8EWhC4bAqEgz7q2ka by lanodan@queer.hacktivis.me
 (DIR) More posts by lanodan@queer.hacktivis.me
 (DIR) Post #B8CeEPYmmk88VQGFdI by lanodan@queer.hacktivis.me
       1 likes, 0 repeats
       
       QBE 1.3: metaprogramming, performance, and cross-platform support [LWN.net] last paragraphs once again makes me annoyed at this ideology that a compiler (specially a compiler backend here) needs to compile itself.As Go devs noted ages ago, if you do it early in the design, it results in compilers and often languages that are only good for compilers.Plus well if you take JIT compilers, the vast majority are written in a language that's different from their target.And then there's the bootstrapping issue, both in terms of trusting-trust, but also in terms of portability because cross-compiling became a massive pain in the ass. Both of which we need for trustworthy and sustainable software.It's the sort of thing that just looks like pure sabotage to me, terribly misguiding and with long-term effects on an ecosystem.
       
 (DIR) Post #B8ClPOFCiWMrI0HfvM by ska@social.treehouse.systems
       0 likes, 0 repeats
       
       @lanodan Yeah this is an ideological pursuit.Ultimately, a compiler needs to be able to compile itself, and after a certain point it might be useful to do so in order to reduce the dependency chain for people who are not interested in a full bootstrap. But making it a priority is absurd and counterproductive.
       
 (DIR) Post #B8ClPOWDhFyk8mFGRk by lanodan@queer.hacktivis.me
       0 likes, 0 repeats
       
       @ska Well a C compiler pretty much always needs to be because there's not exactly a lot of choice before C in terms of possible languages you can depend on, but that's quite unique to their case.Like, I don't think it makes sense for Mono to be written in C#, OpenJDK in Java, GHC in Haskell, … among a bunch of other real examples.
       
 (DIR) Post #B8Crtze4pAeXhQtUeG by ska@social.treehouse.systems
       0 likes, 0 repeats
       
       @lanodan I kinda disagree with that. You could write a C compiler, down to the asm generation, in any existing language (that themselves would likely need a C compiler to bootstrap, but that's not the point). The really interesting part is the assembler. Once you have asm, you need to translate it into machine language, and although you could write an assembler in any language, you really want to be able to bootstrap one, so ideally you'd have a micro-asm hand-written in machine language to build your assembler with.It's the last step that's problematic. Anything above the asm is reading a text file, manipulating some data structures, and outputting a text file. It's a filter, and that can be written in any language.
       
 (DIR) Post #B8CrtzzhWlwymV0lM0 by lanodan@queer.hacktivis.me
       0 likes, 0 repeats
       
       @ska Oh I know you can, live-bootstrap has a basic C compiler written in x86-asm (cc_x86), and another written in some kind of Scheme (mescc).Also it does a sort of micro assembler bringup from a hexdump reader at first to then adding few bits of things in stages all the way to hex with labels + macros.Also I heard DuskOS got a C compiler written in Forth but I haven't checked myself.But none of those are your usual ecosystem, one's a bootstrap ecosystem that you just throwaway once you're done like with an installer, and the other is a very experimental hobby OS that's kind of like restarting+rethinking almost everything from scratch.
       
 (DIR) Post #B8CsgZtTMCe61PGJoe by lanodan@queer.hacktivis.me
       0 likes, 0 repeats
       
       @mid_kid @ska tcc in fact skips the assembler, but sadly it also skips defining something like macros so you end up with random constants in the code.And yeah, it's often quite useful to have compiling + assembling + linking being well separated.After all you always loose a bit of information compared to disassembly output.
       
 (DIR) Post #B8CwzNnkwJ2XpxoKVk by lanodan@queer.hacktivis.me
       0 likes, 0 repeats
       
       @mid_kid @ska Well so far I've yet to really see LTO as worth it beyond being a massive UB detector.
       
 (DIR) Post #B8CxqDJudhi4g52koi by lanodan@queer.hacktivis.me
       0 likes, 0 repeats
       
       @mid_kid @ska Enabled by default sadly isn't much of an indicator, see the other bunch of efforts that distros have been trying in the past 10+ years and still haven't reached.And it's the sort of optimisation that seems more appropriate for more pure languages than C and comparable are.
       
 (DIR) Post #B8E1ifhVPLGUaFGHQ0 by ska@social.treehouse.systems
       1 likes, 0 repeats
       
       @mid_kid @lanodan Sounds like the problem is with linking, not assembling. Linking should be independent from the initial language, right?
       
 (DIR) Post #B8E1netDqnEvW47V56 by ska@social.treehouse.systems
       0 likes, 0 repeats
       
       @lanodan But that's the interesting part, isn't it? The bootstrap environment. That's what needs to be as accessible and reproducible as possible. For people who are not interested in a bootstrap, who cares what language the compiler is written in?
       
 (DIR) Post #B8E1nfBekFz8REkDoW by SRAZKVT@tech.lgbt
       0 likes, 0 repeats
       
       @ska @lanodan those who hack on it care, at least a bit
       
 (DIR) Post #B8E1nfPptXKN9DNXuq by ska@social.treehouse.systems
       1 likes, 0 repeats
       
       @SRAZKVT @lanodan Yes, of course, and that's an argument for having the compiler, or a large part of it, written in the language it compiles.And more importantly than the compiler... the standard library. Having a good stdlib is important. C should have taught us that, at least.
       
 (DIR) Post #B8E1niVyNB1El7GzOi by SRAZKVT@tech.lgbt
       1 likes, 0 repeats
       
       @ska @lanodan like if a compiler for a language i use is written in some fuckass language i'm not contributing, selfhosting i guess guarantees that if someone is interested in contributing to a compiler for a language, then they're fine with that language, and already know it, but that's imo a pretty weak argument because other languages are fine enough too
       
 (DIR) Post #B8EWhBNLlddoozbVL6 by SRAZKVT@tech.lgbt
       0 likes, 0 repeats
       
       @lanodan @ska ocaml in ocaml, idris2 in idris2, chez scheme in chez scheme, etc
       
 (DIR) Post #B8EWhBbAwEhTVs4XtA by ska@social.treehouse.systems
       0 likes, 0 repeats
       
       @SRAZKVT @lanodan It's all ideology. I understand the desire to be self-sufficient (I really do), but there's no simplicity benefit to it.
       
 (DIR) Post #B8EWhBr7yvScJLXHkm by kirtai@tech.lgbt
       0 likes, 0 repeats
       
       @ska @SRAZKVT @lanodan There's also the "I hate working in bootstrap language and want to get away from it as quickly as possible"
       
 (DIR) Post #B8EWhC4bAqEgz7q2ka by lanodan@queer.hacktivis.me
       0 likes, 0 repeats
       
       @kirtai @ska @SRAZKVT Yeah, that one I can somewhat get as after all it can be one of the reasons you created a new language in the first place.And it's why I'm fine with like a very incomplete/old-maintained-branch compiler to get things going (like go1.4, mrustc, …), although those quite often have the issue of not working for architectures/OS/… that are a bit too recent/niche and sometimes having a painfully long compiler chain.
       
 (DIR) Post #B8EWuKJzomDWKbIplI by ska@social.treehouse.systems
       1 likes, 0 repeats
       
       @lanodan @SRAZKVT @kirtai It's a good reason to have as much as possible written in the new language, like, all the stdlib and most of the compiler's features. It becomes more and more of a trade-off as you're getting closer to the bootstrappable core.
       
 (DIR) Post #B8Epr9naNoXrxKLSyG by SRAZKVT@tech.lgbt
       0 likes, 0 repeats
       
       @ska @lanodan @kirtai what i plan to do for my functional lang (eventual) is have a small interpreter, probably written in c, whose only goal is to be somewhat hackable and compatible, not particularly fast or smart beyond what's needed by language directly, and have a compiler for it written in that very languageiirc that's what guile does ?
       
 (DIR) Post #B8EprA8r6jYj1IIS7k by kirtai@tech.lgbt
       0 likes, 0 repeats
       
       @SRAZKVT @ska @lanodan Not sure about guile but it does sound like a good plan.
       
 (DIR) Post #B8EprAKuNvCTcfw4uW by lanodan@queer.hacktivis.me
       0 likes, 0 repeats
       
       @kirtai @SRAZKVT @ska Yeah no idea for guile either, only FP languages I've used have been haskell (never again) and elixir (myeeaah… could be better).
       
 (DIR) Post #B8Evhklmfdv9RrOxo8 by kirtai@tech.lgbt
       0 likes, 0 repeats
       
       @SRAZKVT @ska @lanodan Oh wait, isn't this how ocaml built their bootstrap path?
       
 (DIR) Post #B8EvhkyBvVqU4LCs9A by lanodan@queer.hacktivis.me
       0 likes, 0 repeats
       
       @kirtai @SRAZKVT @ska Nah pretty sure OCaml just ships a small binary seed.