Message-ID: <143493029.14268.1406646504193.JavaMail.firstname.lastname@example.org> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_14267_1488182634.1406646504192" ------=_Part_14267_1488182634.1406646504192 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html
Martin Fowler has a good introduction to closur= es on his bliki.
There are two syntaxes for closures: a block based syntax with syntactic= ally significant whitespace and a braces based that ignores whitespace.
Boo closures have have full access (to read and write) to their enclosin= g lexical environment. For Instance:
The best source of information right now are the test cases for closures= in the tests/testcases/integr= ation directory.
Some things you can do with named functions that you cannot with closure= s include recursion and overloading:
This will not work because "c" is unknown from inside the clos= ure:
so you can use a regular named function or else create a 2nd callable to= hold the name:
And you can use regular named functions to overload a method: