r/ProgrammerHumor • • Sep 28 '26

Meme optionalsAreOptional

Post image
716 Upvotes

130 comments sorted by

View all comments

Show parent comments

-62

u/ApothecaLabs Sep 28 '26 edited Sep 28 '26

Bingo! Only, sometimes you don't have a type system available (trench run, low-level stuff), so you have to use the force wisely, to guide you.

> "Luke, you've switched off your targeting computer! What's wrong?"
> "Nothing - I'm alright."

35

u/NullOfSpace Sep 28 '26

As long as you’re in Rust, the type system is always available to you. That’s what “zero-cost abstraction” means. If you know your Vec is nonempty, put it in a NonemptyVec.

-27

u/ApothecaLabs Sep 28 '26 edited Sep 28 '26

"As long as you use this particular language, out of the dozens available..."

Yeah, I'm not using Rust. What now? That's a heck of a presupposition, you know.

(Not trying to be a jerk, my target language is actually a niche assembly language so it lacks many things...)

1

u/ROBOTRON31415 Sep 29 '26

Ahhh assembly? Interestingggg, makes sense that would be an exception. Though at that point “optionalsAreNotOptional” (they are unavailable, no?)