Hello,
I'm trying to use marshal module to marshal and unmarshal some data. My code looks like this:
import marshal
type
Foo = object of RootObj
id: int
bar: string
let x = Foo(id: 1, bar: "baz")
let y = ($$ x)
let z = y.to[Foo]
When I try to compile this, I get a type error:
m.nim(10, 9) Info: instantiation from here
lib/pure/marshal.nim(245, 38) Error: type mismatch: got (T)
but expected one of:
typeinfo.toAny(x: var T): TAny
What is needed for the type to be unmarshalable?
However, this form is working:
let z = to[Foo](y)
Aren't these two equivalent?