Skip to content

Instantly share code, notes, and snippets.

@gradha
Created February 3, 2013 17:07
Show Gist options
  • Save gradha/4702621 to your computer and use it in GitHub Desktop.
Save gradha/4702621 to your computer and use it in GitHub Desktop.
Unexpected nimrod idetools behaviour on $data.str_val
type
Tparam_kind* = enum PK_EMPTY, PK_STRING
Tparsed_parameter* = object
case kind*: Tparam_kind
of PK_EMPTY: nil
of PK_STRING: str_val*: string
proc `$`*(data: Tparsed_parameter): string {.procvar.} =
case data.kind:
of PK_STRING: result = "\"" & $data.str_val & "\""
else: nil
when isMainModule:
var a : Tparsed_parameter
a.kind = PK_STRING
a.str_val = "hey"
echo ($a)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment