in reply to Re: Real life uses for closures.
in thread Real life uses for closures.
> However, in a real world app one needs to create callbacks on the fly, without knowing beforehand what exacly they whould do. And closures rock.
Good points, I agree with you about the use cases!
Just your definition of closures seems to be reduced to just generating anonymous functions.
That's not the point, the main characteristic of closures is accessing variables from the outer scope at definition/generation time, most efficiently even shared between multiple closure-functions.
So a real-world example should include shared private variables.
Cheers Rolf
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: Real life uses for closures.
by Dallaylaen (Chaplain) on Feb 14, 2013 at 20:11 UTC | |
by davido (Cardinal) on Feb 15, 2013 at 17:40 UTC |
In Section
Seekers of Perl Wisdom