You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import std/[parseutils]
procparseHook*[T: enum](s: string, i: varint, v: var T) =var temp: intinc i, parseInt(s, temp, i)
v =T temp
procdumpHook*(s: varstring, v: enum) =
s.add$v.int
Expected behaviour
compiles successfully and considers enums as ints
Current output
/wrapper.nim(10, 14) template/generic instantiation of `fromJson` from here
/.nimble/jsony/jsony.nim(590, 4)
Error: ambiguous call; both
jsony.parseHook(s: string, i: var int, v: var T: enum) [proc declared in /.nimble/jsony/jsony.nim(406, 6)]
and
inner.parseHook(s: string, i: var int, v: var T: enum) [proc declared in inner.nim(3, 6)]
match for: (string, int, Enum)
The text was updated successfully, but these errors were encountered:
hamidb80
changed the title
what if I don't want the default behaviour of enum ?
[RESOLVED] what if I don't want the default behaviour of enum ?
Aug 26, 2023
hamidb80
changed the title
[RESOLVED] what if I don't want the default behaviour of enum ?
what if I don't want the default behaviour of enum ?
Aug 27, 2023
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
The text was updated successfully, but these errors were encountered: