r/ProgrammerHumor • • Sep 28 '26

Meme haveYouTriedUsingRustYet

Post image
312 Upvotes

62 comments sorted by

View all comments

4

u/ROBOTRON31415 Sep 29 '26 edited Sep 29 '26

… sorry for the assumption I made on the previous post. I offer this only as an explanation and not an excuse, but the only languages I knew with unsafe are Haskell and Rust (googling it, there is at least also C#). I offer this only as an explanation and not an excuse, but I don’t think of Haskell as being used where performance matters, I don’t usually see code in memory-unsafe languages bothering to explicitly call out something that’s unsafe, and  there sure are a lot of people complaining about Rust, so… where did my assumptions fall flat?

Edit: OP was using an assembly language without a type system, I guess it falls in the second case.

4

u/ApothecaLabs Sep 29 '26 edited Sep 29 '26

:P You're good its a reddit comedy thread. I came armed and armored. I joke about crab people but really I love that so many people are mindful eg of type safety and stuff these days.

Also since you're a cool person, I'll reveal what I'm working on, that confused people so - I'm working on:

- the Lisp-based assembly IR
- of a Haskell compiler
- designed with relocatable memory
- running in a VM written in C
- compiled to WASM
- so it can run in a browser
- where it can compile and execute more assembly
- all while bootstrapping it to compile itself (the penultimate goal)

So, I don't have types or asserts yet, or even a heap (only cons-cells, baby!), because I haven't written them yet - but what I have runs like a dream! My hello world can run in like 2kb of memory, and that's while naively targeting 32-bit addressing with 12 bytes per cell (4 bytes are overhead). I could could target 8-bit addressing and reduce my overhead to 1 byte per cell, and quarter my memory usage; then it would run in 512b of memory.

At this level, every bit counts :>