I am sorry I was not entirely fair. I do not understand lambdas in Nim very 
well. It would be nice to know how they work internally, so I would feel more 
comfortable to use them, and I can predict better what they are able to do and 
what they are not able to do. I only know two kinds of lambdas:

C++: In C++ lambdas are very explicit in what they capture, and how they 
capture it. When I capture something by reference, it is in my responsibility, 
that the lambda does not outlive the lifetime of the objects it references. 
Other things I can simply pass as value

Scala: In scala lambdas are compiled to simple java casses. Everdthing that 
applies to classes also applies to lambdas. No surprises here. But unlike java 
they made the corner cases that are a bit harder to compile just work.

In Nim everything is a bit more mysterious to me. The syntax to create lambda 
objects is not as compact as the scala representation (especially with the 
lambda argument type inference). In the end I just don't use lambdas as often 
as I would like to, just because of that. I haven't checked the documentation 
recently though.

Reply via email to