News for hackers. Stuff that matters.
Re:“I'm basically giving myself a permanent vacation from be... by idontpost on Thursday July 12, 2018 @11:34PM (#17520332)
So basically Clojure protocols? As in, multimethods that dispatch on the type of their first argument?
Re:“I'm basically giving myself a permanent vacation from be... by joshuamorton on Thursday July 12, 2018 @11:45PM (#17520390)
Except that assuming Animal is a sum type (kind of like an enum), the computer will complain.

So a maybe type (equivalent to an Optional) is simply a sum over just and nothing (the two components). If you fall to handle nothing, the program won't compile.

Animal would work the same way. Add "Cow" as an animal, and your program won't compile until everything sanely handles Cow.

So more like a switch case over a set of options where the compiler prevents you from forgetting any.