which is marked closed.
However, when I try compiling that same code I get:
Hint: system [Processing]
Hint: nestiter [Processing]
Error: internal error: (filename: compiler/lambdalifting.nim, line: 196)
No stack traceback available
To create a stacktrace, rerun compilation with ./koch temp c <file>
Here is the code (named nestiter.nim):
factory(): int {.closure.} =
iterator bar(): int {.closure.} =
yield 0
yield 1
yield 2
for x in bar(): yield x
for x in factory():
echo x
What am I failing to do?
You need to use the most recent devel branch of the Nim compiler, see these instructions: https://github.com/nim-lang/nim#compiling
Edit: Just checked, it also works with the 0.13.0 release from the website. So you could use that as well. I guess you're on an older version of Nim.