News for hackers. Stuff that matters.
Re:Why Checked Exceptions Failed by cubefox on Saturday July 15, 2023 @09:52AM (#36736755)
Something like String|NoAnswer|None doesn't sound too bad to me here...
Re:Why Checked Exceptions Failed by DougBTX on Saturday July 15, 2023 @10:01AM (#36736834)
This isn’t just a problem with custom types, it affects generic iteration types too. With a next() -> Option<T> method, an Iterator can iterate over any type of element.
Re:Why Checked Exceptions Failed by cubefox on Saturday July 15, 2023 @11:27AM (#36737676)
Yeah, but there could be a type T for "any type" additional to union types, basically like TRUE in Boolean logic. (Theoretically you could also have F for "no type", intersection types (AND), negation types (not Foo), and any logical complex of those.)
Re:Why Checked Exceptions Failed by Skeime on Saturday July 15, 2023 @05:04PM (#36740927)
Except that NoAnswer has none of the language’s (and it’s library’s) support for the built-in None. And you might run into problems when trying nest the data structure, which might be a reasonable thing for your users to do.
Re:Why Checked Exceptions Failed by cubefox on Sunday July 16, 2023 @09:35AM (#36746830)
I just think that the nesting offered by Option & Co has overall much more downsides than upsides compared to union types.