[Next] [Previous] [Up] [Top] [Contents] [Index]

2.1 Objects and Inheritance

2.1.5 Closures

Cecil includes closure objects which represent first-class anonymous functions. Closures are lexically nested in their enclosing scope. As with methods, a closure can have formal arguments. A closure object is "invoked" by sending it the eval message, with additional actual arguments for each of its formal arguments. Closures are considered to inherit from the closure predefined object.

More details on closures are given throughout the remainder of section 2. In particular, section 2.5.9 describes the syntax and semantics of closure constructor expressions and section 2.2.2 describes the evaluation rules for closure eval methods.