It looks like you are trying to retrieve all symbols' names of a module, which as far as I know is not possible in Nim (not yet, at least). There is still an open Pull Request to add this feature, but it hasn't been merged yet: https://github.com/nim-lang/Nim/pull/9560
More information about this in a thread from the Nim forum: https://forum.nim-lang.org/t/7012
However, if you need it for objects, it is possible to use both typeinfo.fields and iterators.fieldPairs (note: modules are not objects in Nim).
Example code for typeinfo.fields:
import typeinfo
type MyObj = object
a: string
b: int
var obj = MyObj(a: "asd", b: 123)
for (name, _) in fields(obj.toAny):
echo name ## will echo "a" and "b"
Example code for iterators.fieldPairs:
type MyObj = object
a: string
b: int
var obj = MyObj(a: "asd", b: 123)
for name, value in obj.fieldPairs:
echo name, ": ", value
⚠️ Note that when using fieldPairs, loop is actually unrolled, as written on official documentation.
Here's an example of fieldPairs used in stdlib (json): lib/pure/json.nim.