-
Notifications
You must be signed in to change notification settings - Fork 0
Closures Hierarchy
The Closure classes have three basic 'layers'. The first is made up of the AbstractClosure classes, which are used to construct new closures. The methods and variables available to AbstractClosure are useful while implementing them, but create clutter when using them. To that end, each AbstractClosure class implements a corresponding Closure interface, which hides the unnecessary parts.
Still, some methods like curry(...) can modify the closure, and you would probably rather that nobody else did that but you. To further reduce the functionality the AbstractClosure or Closure objects can return a 'View'. A View provides only the basic methods to work the closure. Its name also more accurately spells out what it is: a view. A single closure can have any number of active views, and changes to the closure will affect the views. Views are what is often passed around, since recipients need only run them and be aware that they are potentially mutable from the outside.