Hm, are you sure you need pointers? Usually references are better (as
references are tracked by the garbage collector).
Also, runtime type data doesn't work like this. The is operator works at
compile time. What I think you want to do is this:
type
NodeValueKind = enum
nvString
nvBool
NodeValue = ref object
case kind: NodeValueKind
of nvString:
stringValue: string
of nvBool:
boolValue: bool
Node = ref object of RootObj
Values* : Table[string, NodeValue]
Map : Table[string, string]
proc `[]`(parser : ArgParser, key : string): NodeValue =
if parser.Values.hasKey(key):
return parser.Values[key]
Run
Unlike languages such as Python or Go, Nim doesn't rely on
runtime-type-information all that much. There is a module for run-time-type
information, but it's somewhat advanced... and unsafe.