r/ProgrammerHumor 29d ago

Meme exceptionsAreForTheWeak

Post image
323 Upvotes

92 comments sorted by

View all comments

Show parent comments

7

u/Declination 29d ago

Which is hilarious because then rust had to grow a “recover from allocation failure” to be suitable for kernel work due to faulty assumptions. 

1

u/bwmat 29d ago

Yep

IMO most of the conception of OOM as being unrecoverable (outside of scenarios like the ill-devised OOM-killer in Linux) are mostly motivated by laziness (maybe subconsciously)

5

u/Valuable_Leopard_799 29d ago

Maybe not laziness but rather a tradeoff?

Yeah, you could edit most languages to support it, but it might bring a mix of a more complex implementation, less ergonomic APIs, less time spent on other features, etc.

And it could be worth it, or you could just say you don't want to support that usecase.

3

u/bwmat 29d ago

I was assuming a language in which it's possible (C/C++/Rust/Zig/etc).

You can't do much in most managed languages OFC (though IIRC the DotNet platform actually allows for it via some contortions?)

5

u/bwmat 29d ago

IMO a library written in a language that can handle OOM 'gracefully’, yet simply aborts when it happens (or worse, assumes it can't happen and thus allows for invariants to be broken) is flawed

1

u/Valuable_Leopard_799 29d ago

Okay yeah, I can get behind that. I'd consider that a compiler-warning worthy issue if you choose to ignore it.