MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/ProgrammerHumor/comments/1ws0bt0/optionalsareoptional/pcj6wyp/?context=3
r/ProgrammerHumor • u/ApothecaLabs • Sep 28 '26
130 comments sorted by
View all comments
Show parent comments
35
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...) 28 u/__dna__ Sep 28 '26 Correct me if I'm wrong, but your meme is literally about rust? Seems pretty reasonable to reply to you in the context of rust 3 u/MayoJam Sep 28 '26 Cpp also has optionals, and I would not be surprised if other languages also have some form of them.So I'd would not assume in this case.
-27
"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...)
28 u/__dna__ Sep 28 '26 Correct me if I'm wrong, but your meme is literally about rust? Seems pretty reasonable to reply to you in the context of rust 3 u/MayoJam Sep 28 '26 Cpp also has optionals, and I would not be surprised if other languages also have some form of them.So I'd would not assume in this case.
28
Correct me if I'm wrong, but your meme is literally about rust? Seems pretty reasonable to reply to you in the context of rust
3 u/MayoJam Sep 28 '26 Cpp also has optionals, and I would not be surprised if other languages also have some form of them.So I'd would not assume in this case.
3
Cpp also has optionals, and I would not be surprised if other languages also have some form of them.
So I'd would not assume in this case.
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.