> The toto.nim(10, 13) Error: cannot use symbol of kind 'let' as a 'param' 
> error you were experiencing was because you used m as the name for the 
> template parameter AND for the iterator parameter. Templates will expand 
> input parameter names to something like m`gensym4552018, so you need to name 
> the parameter of your inner iterator something different. In the code above, 
> I simply renamed it to melon.

That's the second time I've got bitten by that and I even [wrote it in the Nim 
wiki](https://github.com/nim-lang/Nim/wiki/Tips-and-tricks#error-template-instantiation-too-nested)
 as a vicious cause of bugs with templates... I think I'll add it a second time 
in that page.

But even with your code using the anonymous iterator, I still can't compile it, 
now with a different error message `Error: ignored invalid for loop`.

I've setup a [playground version](https://play.nim-lang.org/#ix=2nl1) to be 
able to try different Nim versions.

I think that when I pause on my current project, I'll dedicate some time to 
understand Nim compiler and find a way to improve error messages. I spend so 
much time trying to understand what they mean and [where they 
apply](https://forum.nim-lang.org/t/6339#39060)...

Reply via email to