However, I maintain that closures are an extremely difficult thing for non-functional programmers to grasp. Using an anonymous subroutine returned from a closure-generator gives someone the idea of what's going on so that they can at least grasp the basic feel.
I say this cause that's how I learned about them. This isn't to say that in an environment where someone could be guaranteed to have the learner's attention for more than one reading, the more correct notion should be pushed.
I guess what I'm saying is that anon subs are a tool. Closures are a concept. I often implement the concept "closure" using the tool "anon sub". (Just like I sometimes prefer implmenting the concept "object instance" using the tool "blessed closure".)
------
We are the carpenters and bricklayers of the Information Age.
Don't go borrowing trouble. For programmers, this means Worry only about what you need to implement.
In reply to Anon subs are a good way to introduce closures
by dragonchild
in thread subs as args
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |