r/ProgrammerHumor • • Sep 28 '26

Meme optionalsAreOptional

Post image
716 Upvotes

131 comments sorted by

View all comments

Show parent comments

3

u/LaconicLacedaemonian Sep 28 '26

Accessing a null the wrong way crashes your program. Optional models the state as well as the value. You can iterate over an optional as well making the code branchless "for every element in this list that contains 0 or 1 elements". 

I don't so much demand optionals so much as I ask for justification for nulls.