Hi,
Consider this code:
import macros
type Something = object
manyStrings: seq[string]
macro MyMacro(): untyped =
var something = Something()
return quote do:
`something`
let x: Something = MyMacro() # type mismatch: got <array[0..-1, empty]> but expected 'seq[string]'
Does someone know why this won't work?
It works for objects without seq[string], e.g.
type Something = object
oneString: string
Thanks a lot and best regards, David
Hi @ynfle, thanks a lot!
However, I'd like to create a sequence of Something in the macro itself (a loop, creating many Something and filling the manyStrings property), then in the quote I only want to return this sequence, like this.
Actually I have a suggestion for everyone, who used laptop or desktop. So I have the best information for them. Just look into it.