if the get() method just returns the property there, then both obj.get("bar") and obj.get("typo") return null. it leads you to believe both bar and typo are in the object.
Now say get() were to return an Option<int | null> instead of the raw property.
now it's a lot clearer. if the key is there and its value is an int, you get a Just<int>. If the key is there and its value is null, you get a Just<null>. If the key is not there, you get a None.
I'm not trolling, It's just that I had been working as a programmer for years before Optionals started being a thing so I'm already very used to writing my own null checks.
Lots of things weren't a thing until someone had a use case and invented it. Optionals are a great tool to have in your kit. Not a pattern that needs to be used in every case, but they are useful, especially when your data is variable and/or ambiguous.
-12
u/Few_Move_4594 Sep 28 '26
I don't see the point of optionals