News for hackers. Stuff that matters.
Re:You’re better off using Exceptions by detaro on Monday February 03, 2020 @01:01PM (#22226922)
What "functional programming features" does one need for useful optional types?
Re:You’re better off using Exceptions by kibwen on Monday February 03, 2020 @01:23PM (#22227203)
Putting aside the "functional" bit, for a language to allow user-defined (i.e. not hardcoded into the language itself (which may not necessarily be a bad thing, but that's beside the point here)) optional types, you'd want the ability to say "this variable is either _this_ XOR _this_" (a.k.a. tagged unions/sum types/what Rust calls "enums"), and then in a statically-typed language you'd additionally want generics.