Message-ID: <451677533.42056.1371697203528.JavaMail.email@example.com> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_42055_214676230.1371697203528" ------=_Part_42055_214676230.1371697203528 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 closures on his bli= ki.
There are two syntaxes for = closures: a block based syntax with syntactically significant whitespace an= d a braces based that ignores whitespace.
Boo closures hav= e have full access (to read and write) to their enclosing lexical environme= nt. For Instance:
The best source of information right now are the test cases = for closures in the tests/test= cases/integration directory.
See Functions As Objects.
Some things you can do with named fun= ctions that you cannot with closures 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= :
Functions, Paramete= rs, Callable Types, Events------=_Part_42055_214676230.1371697203528--