> what the best way to do it would be

Don't make kind a case variant:
    
    
    type
      ObjKind = enum typeA, typeB
      Obj = ref object
        kind: ObjKind
        contents: seq[Obj]
    
    
    Run

if that doesn't work for your actual use case, then you need to provide more 
info. To me, just changing the kind of an object variant without changing the 
whole object doesn't make semantic sense.

(BTW, if your object is really defined like that, you probably want to add an 
`{.acyclic.}` pragma.)

Reply via email to