Types: Anonymous Function Objects
Hack supports the ability to encapsulate an unnamed function and to use it, or save it for later use, in the context of an anonymous function object. We can exploit this idea when solving various kinds of problems. For example, a sorting function can sort items in different orders based on sort-key comparison order. If we have an anonymous function that encapsulates one of some number of compare-functions (such as case-sensitive, case-insensitive, and dictionary-sort), we can choose the desired approach, encapsulate it, and pass that anonymous function to the sort function to use in its comparison.
Anonymous functions contains examples of creating and using functions using both closure and lambda notation.