Hey, I want to use an iterator as argument for a function. I know, that iterators cant be passed around, and they need to be wrapped in functions. However, I cant get it to work. I something like this: import tables, sugar type Iterable[T] = proc: iterator: T proc iterSomething(xs: Iterable[int])= for x in xs()(): echo x let dict = toTable {1:2, 3:4} iterSomething(() => dict.values) Run
which will produce the following error: Error: undeclared field: 'values' found 'tables.values(t: OrderedTableRef[values.A, values.B]) [declared in /home/felix/.choosenim/toolchains/nim-1.4.0/lib/pure/collections/tables.nim(2118, 10)]' of kind 'iterator' found 'tables.values(t: CountTable[values.A]) [declared in /home/felix/.choosenim/toolchains/nim-1.4.0/lib/pure/collections/tables.nim(2529, 10)]' of kind 'iterator' found 'tables.values(t: OrderedTable[values.A, values.B]) [declared in /home/felix/.choosenim/toolchains/nim-1.4.0/lib/pure/collections/tables.nim(1710, 10)]' of kind 'iterator' found 'tables.values(t: CountTableRef[values.A]) [declared in /home/felix/.choosenim/toolchains/nim-1.4.0/lib/pure/collections/tables.nim(2805, 10)]' of kind 'iterator' found 'tables.values(t: Table[values.A, values.B]) [declared in /home/felix/.choosenim/toolchains/nim-1.4.0/lib/pure/collections/tables.nim(708, 10)]' of kind 'iterator' found 'tables.values(t: TableRef[values.A, values.B]) [declared in /home/felix/.choosenim/toolchains/nim-1.4.0/lib/pure/collections/tables.nim(1136, 10)]' of kind 'iterator' Run I don't really understand how this error comes to be. How can I pass arbitrary iterators without converting them to a sequence?