Re:Compiler Reminders
by JonChesterfield on Sunday April 27, 2025 @08:43AM
(#43811526)
Exhaustive compile time checking of dispatch statements is a wonderful thing, sorely missing from the languages that decided "sum types" are a bit weird and niche.
[ Parent
| on HN ]
Re:Compiler Reminders
by fredrikholm on Sunday April 27, 2025 @02:15PM
(#43813971)
They make it near impossible to extend from the outside.
I can pass a Reader interface to your function, but I cannot (easily) add a
> | UnusualProtocol(Socket)
as a third party consumer.
Other than that, sum types are the better abstraction. With exhaustive first class pattern matching (eg. with proper matching on destructuring), nothing comes close in terms of ergonomics.
Re:Compiler Reminders
by hermanradtke on Sunday April 27, 2025 @10:13PM
(#43816885)
That is a feature. Compose instead of extending.