News for hackers. Stuff that matters.
Re:You’re better off using Exceptions by erik_seaberg on Monday February 03, 2020 @04:19PM (#22229237)
If a user doesn't exist, any code that relies on having a user is broken, and I want a guarantee that code can't be reached. Throwing does that, mapping an Option does that, but "if" doesn't.
Re:You’re better off using Exceptions by baddox on Monday February 03, 2020 @06:39PM (#22230620)
That's just a matter of a specific language's syntax, type-checking, or linting. Pattern-matching in OCaml [0] will in most cases warn about non-exhaustive checks. It seems like TypeScript has something similar, although I haven't used it [1].

[0] https://www2.lib.uchicago.edu/keith/ocaml-class/pattern-matc...

[1] https://dev.to/babak/exhaustive-type-checking-with-typescrip...