I’ve seen some switches over TypeKind more easily expressed as a series of
if/else if statements also.
However unless you come across an ugly switch that you want to refactor while
working on something else, I probably wouldn’t spend time actively seeking them
out and changing them. I don’t think switching over the kind is considered a
code smell in itself.
> On Aug 11, 2017, at 2:48 PM, David Zarzycki via swift-dev
> <firstname.lastname@example.org> wrote:
> Before I spend time creating patches, are there arguments against converting
> exhaustive switch statements to the visitor pattern in the Swift source base?
> In particular, I’m curious about switches that reason about the TypeKind enum.
> – Dave
> swift-dev mailing list
swift-dev mailing list