Local accumulators for cleaner comprehensions

I liked the idea, but what about make it more general and call it let instead of accum, in a way that allows the same mechanism in a specific closed scope. I know that this resembles a closure mechanism, that would be useful in several ways, not only when using comprehensions.

EDIT:

There is an old proposal that seems to go in the same direction, but why not just make it more general, it would be useful and really explicit because any reference to that scoped variables outside a let block would be caught by Elixir compiler.

1 Like