What about the object variant safety issue? type DocKind = enum text, todo Doc = object case kind: DocKind of text: text: string of todo: todo: string let doc = Doc(kind: text, text: "some doc") echo doc.todo#compiles, throws exception Run
As far as I can tell, preventing this generally would require forbidding access of variant fields when not inside a `case kind` typeguard. Would that tradeoff between flexibility and safety be desirable?