Created
November 4, 2011 11:38
-
-
Save zah/1339159 to your computer and use it in GitHub Desktop.
New closure syntax
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| new closure syntax: | |
| do (formal args): block | |
| # passing a closure as a last argument of a nkCall or nkCommand | |
| command "Foo" do (args: string): | |
| code | |
| code | |
| code | |
| btn.click do (e: TClickEvent): | |
| code | |
| code | |
| code | |
| traverseTree(tree) do (node: PNimrodNode): | |
| code | |
| code | |
| code | |
| # could also be a Coroutine but other similar examples exist | |
| # passing a closure without arguments still uses the old short-hand syntax | |
| inGuiThread: | |
| code | |
| code | |
| code | |
| inThread(t): | |
| code | |
| code | |
| code |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment