-
Notifications
You must be signed in to change notification settings - Fork 148
Functions As Objects
Nathaniel Sabanski edited this page Jan 20, 2016
·
6 revisions
Added by Rodrigo B. de Oliveira
Functions and methods in boo are first class objects whose type exposes some very useful methods:
- Invoke() as : invokes the function synchronously (pretty much the same as using () in front of the function name)
- BeginInvoke(<function args, > callback as AsyncCallback, asyncState) as IAsyncResult: invokes the function asynchronously and returns a handle that can be used to check the status of the execution as well as recovering the return value
- BeginInvoke(<function args, > callback as AsyncCallback) as IAsyncResult: the same as above without the asyncState parameter
- EndInvoke(asyncResult as IAsyncResult) as : finishes an asynchronous invocation returning the final value
Invoke in action:
print("Hello!")
print.Invoke("Hello!!")
print.Invoke.Invoke("Hello!!!")
See Asynchronous Design Pattern for examples of BeginInvoke/EndInvoke in action.