3 ms·
You might want to layer some sugar on top to enable naming of the variants. I was just trying to keep my example as close as possible to valid Go code. Even if
by foldr 2y ago
You might want to layer some sugar on top to enable naming of the variants. I was just trying to keep my example as close as possible to valid Go code.
Even if you have to manually define separate named structs, you still have the benefit of exhaustivity checking in type switches. That's arguably the other 10% that people want.