Comment
Comment by mndrix
His solution and syntax remind me of Ada's variant records. Despite Ada's focus on safety, it also resorts to runtime exceptions for incompatible fields in that case. That's probably a local maximum in the language design space.