# Hi, I am not sure if this is the right channel to ask but I was just curious. I # am learning Nim and came across this example # This is an example how an abstract syntax tree could be modelled in Nim type NodeKind = enum # the different node types nkInt, # a leaf with an integer value nkFloat, # a leaf with a float value nkString, # a leaf with a string value nkAdd, # an addition nkSub, # a subtraction nkIf # an if statement Node = ref object case kind: NodeKind # the `kind` field is the discriminator of nkInt: intVal: int of nkFloat: floatVal: float of nkString: strVal: string of nkAdd, nkSub: leftOp, rightOp: Node of nkIf: condition, thenPart, elsePart: Node var n = Node(kind: nkFloat, floatVal: 1.0) # the following statement raises an `FieldDefect` exception, because # n.kind's value does not fit: n.strVal = "" # What is happening here makes sense I think. I was just wondering does this # create one Node type and just disable certain fields or does it create 6 nodes # types?