mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-06 07:38:24 +00:00
```nim
type
NodeKind = enum
nkInt, nkStr, nkAdd
Node = object
case kind: NodeKind
of nkInt: intVal: int
of nkStr: strVal: string
of nkAdd: left, right: ref Node
proc newInt(v: int): ref Node =
new(result)
result[] = Node(kind: nkInt, intVal: v)
let n = newInt(42)
echo n.intVal
```
gives `unhandled exception: key not found: (module: 68, item: 3)
[KeyError]`