Open hamidb80 opened 1 year ago
mixing wrapper.nim
and inner.nim
works fine, but I cannot separate them
as a quick workaround I made a file called jsony_fix.nim
:
import std/parseutils
proc parseHook*[T: enum](s: string, i: var int, v: var T) =
var temp: int
inc i, parseInt(s, temp, i)
v = T temp
proc dumpHook*(s: var string, v: enum) =
s.add $v.int
and include it wherever I import Jsony:
import jsony
include jsony_fix
Hey,
This is because you are trying to override a library function precisely. I'm not sure what the best solution is. If you had proc parseHook*[MyEnum], it would work. But you seem to want to override the general one. I'm not certain Nim supports this. I'm glad you found a workaround.
Hey,
I just want to store
enum
s asint
s,wrapper.nim:
inner.nim
Expected behaviour
compiles successfully and considers
enum
s asint
sCurrent output