Thanks a thousands for the work around!

I saw it working in the playground and I reported it in my project, but I still 
got the same error. Then I reminded that I had [put doc comments in my 
template](https://github.com/nim-lang/Nim/issues/9230). Bingo! That was the 
reason again for this error.

And in order to keep the doc comments, the issue shows that strangely 
    
    
    template pairs*(m: Melon): tuple[key: int, val: int] = ##
      ## Works
      (iterator(melon: Melon): tuple[key: int, val: int] =
        ...
    
    
    Run

while 
    
    
    template pairs*(m: Melon): tuple[key: int, val: int] =
      ## Does not work! ==> Error: ignored invalid for loop
      (iterator(melon: Melon): tuple[key: int, val: int] =
        ...
    
    
    Run

doesn't!

Nim parser accepts a very flexible syntax that makes the language extensible 
but is full of mystery.

Reply via email to