Re:A liar who always lies says "All my hats are green."
by MrMcCall on Tuesday December 10, 2024 @11:53AM
(#42378597)
The best I've found are languages like F# that allow you to return a pair of values, which for your example would be a tuple of (bool, bool), where the first is isError and the second is the evalResult. Of course, you better not mix `em up!
As to paradigms, I've not seen anything yet, but I haven't seen it all, and corporate America has their legacy systems that limit their explorations.
I think best you could do is make a validation check that throws an error if there's no hats at all, but would that make sense?
What if you have a function that has to return a boolean and not throw an error.