OK, let me explain what I'm trying to do. Let's say we have a function that takes a (ref) object as an argument. Like this:
proc myProc(x: MyObj) =
# do sth
and and object like this:
type
MyObj* = ref object
case kind*: ObjKind:
of typeA : s: string
of typeB : i: int
One way would be to check the object's "kind" from inside the function, like if x.kind==typeA:, etc.
The question is: could this be done in any different way, like normal function overloading?
Maybe this is useful:
type
TypeAObj = object
s: string
TypeBObj = object
i: int
MyObj* = ref object
case kind*: ObjKind
of typeA: a: TypeAObj
of typeB: b: TypeBObj
proc myProc(a: TypeAObj) = ...