Re:Show HN: A utility for running exhaustiveness checks on “...
by pbnjay on Monday March 20, 2017 @10:03AM
(#13914286)
I made a similar comment on the reddit post. This seems like something handled better by interfaces.
In my experience, whenever I end up writing a large type switch on an interface I take it as a code smell. All those cases should be an interface method. Only in rare instances (base case serialization of builtin types for example) would I really think type switches make sense.
In my experience, whenever I end up writing a large type switch on an interface I take it as a code smell. All those cases should be an interface method. Only in rare instances (base case serialization of builtin types for example) would I really think type switches make sense.