8 ms·
> I'm sorry, but I don't think you understand the purpose that "Optional" was intended to serve. Lol, your response is the equivalent of the old SNL "IT guy" s
by hn_throwaway_99 4y ago
> I'm sorry, but I don't think you understand the purpose that "Optional" was intended to serve.
Lol, your response is the equivalent of the old SNL "IT guy" skits: "Silly programmer peasant, you don't even know what a monad is!"
Regardless of what you may think Optional was intended to serve, I have seen its use across large and varied code bases, and it simply does not make the cognitive burden easier for developers.
Again, look at the example given by the GP comment. Of course Optional isn't intended to be used that way. But the fact is, as the compiler doesn't prohibit it, it WILL get used that way, and it doesn't provide strong guarantees about the state of the variable.