3 ms·
You asked how sum types work in assembly. I'm telling you that at least 3 compilers figured that part out.
by pdimitar 4mo ago
You asked how sum types work in assembly. I'm telling you that at least 3 compilers figured that part out.
- lelanthran 4mo ago> You asked how sum types work in assembly. No, I didn't - I asked how sum types were supposed to work in an era of 64KB memory systems.
- imtringued 4mo agoThey don't need extra memory in Rust for the case of nullable pointers. The boring cases require an enum tag in C too. By bringing up the one thing that doesn't matter, your argument becomes purely ideological.
- lelanthran 4mo agoYou're missing the point - give me a Rust compiler that can run and compile in 64KB memory, then you'll understand that the language C was constrained not just by what the output is running on, but by what the machines of the time could actually handle during compilation.
- Parodper 4mo agoBorland's PASCAL did it on the IBM PC. And which modern C compiler fits into 64KB? Even TCC needs 100KB. But that's beside the point. No machine of the last 36 (I'll push my chances, 40) years needs to fit a compiler in 64KB.
- atherton94027 4mo agoPascal had pointers? They could be `nil` too https://www.freepascal.org/docs-html/ref/refse15.html https://www.freepascal.org/docs-html/ref/refse15.html
- Parodper 4mo agoThe thread talked about sum types, which apparently appeared on ALGOL; although I don't know how much memory did an ALGOL compiler need.
- lelanthran 4mo ago> Borland's PASCAL did it on the IBM PC. That's famously a single-pass compiler. Rust is famously unable to compile in a single pass. It is not possible to make a borrow-checking language that compiles in a single pass. > No machine of the last 36 (I'll push my chances, 40) years needs to fit a compiler in 64KB. Exactly - that's why C is what it is: it wasn't a mistake, they were working under the constraints of the time. My original comment (that you appeared to disagree with) said specifically "Remember where C came from and why it was designed the way it was." Let me ELI5 it for you: It was specifically designed to emit assembly in a single pass because of the constraints of the time. WTF does "Hur Dur Rust Goodest!" comments mean in this context?
- Parodper 4mo ago> That's famously a single-pass compiler. Rust is famously unable to compile in a single pass. I probably should have replied under the other comment. I was also referring to your > No, I didn't - I asked how sum types were supposed to work in an era of 64KB memory systems. But context got lost between replies. > that's why C is what it is C famously had a big redesign in 1990. The language of today isn't the same K&R printed.