News for hackers. Stuff that matters.
Re:Tagged Unions Are Overrated by jasperry on Friday February 19, 2021 @08:40AM (#26193011)
I think the best solution to this is when the language's syntax supports ORing cases together like this:

    let analyze_control_flow stmt =
        match stmt with
        | If _ true_branch false_branch -> ...
        | While _ body -> ..
        | Assign _ _ | ExprStatement _ | Return ->  ...
So you still get to avoid repeating code, but all the variants are included visibly and the compiler can verify it.

There are no comments on this comment yet.