MF Bliki: Closure
Popularity Report
![]() |
|||
![]() |
|||
![]() |
|||
![]() |
|||
![]() |
|||
![]() |
URL Tag Cloud
Bookmark History
Saved by 9 people (-1 private), first by anonymouse user on 2006-04-27
- Gwiley72 on 2009-01-25 - Tags Closures
- Harjeet on 2007-12-03 - Tags architecture , ruby
- Dongfei on 2007-09-27 - Tags closures , programming , functional , language
- Priyadarshan on 2007-06-04 - Tags closure , programming
- Cwinkler on 2007-02-27 - Tags closure , ruby , spider
Public Sticky notes
So the first crucial point about closures is that they are a block of code plus the bindings to the environment they came from. This is the formal thing that sets closures apart from function pointers and similar techniques.(Java's anonymous inner classes can access locals - but only if they are final.)
The second difference is less of a defined formal difference, but is just as important, if not more so in practice. Languages that support closures allow you to define them with very little syntax. While this might not seem an important point, I believe it's crucial - it's the key to make it natural to use them frequently. Look at Lisp, Smalltalk, or Ruby code and you'll see closures all over the place - much more frequently used than the similar structures in other languages. The ability to bind to local variables is part of that, but I think the biggest reason is that the notation to use them is simple and clear.
Highlighted by harjeet


Public Comment