Re:Show HN: A utility for running exhaustiveness checks on “...
by infogulch on Monday March 20, 2017 @10:04AM
(#13914295)
From the readme:
> The go-sumtype command recognizes this pattern, but it needs a small amount of help to recognize which interfaces should be treated as sum types
Why is this? Have you tried detecting sum types automatically? Maybe some heuristics like: package-level declaration of the interface, has an unexported method, has more than one type that implements it, maybe also the interface itself is exported.
Re:Show HN: A utility for running exhaustiveness checks on “...
by burntsushi on Monday March 20, 2017 @10:18AM
(#13914405)
It seems unwise to do exhaustiveness checks automatically on an interface that "might" be a sum type. The declaration is a single line and has the benefit of being completely unambiguous.
Indeed! I've been writing Go code daily for years. My open source life is just a bit more consumed by Rust these days. :-)