Programmer Reference : Asynchronous Programming
Asynchronous Programming
This application provides support for asynchronous programming with Futures. Futures are objects that represent a computation whose return value might not be available yet. They are often used for potentially lengthy computations such as I/O and interaction with users.
User Objects
EsFuture - An object representing a delayed computation.
EsPromise - A way to produce EsFuture objects and to complete them later with a value or error.
FEATURES:
Task Scheduler:
Specialized task scheduler that helps ensure the user has a chance to add all required exception handlers to a future before the future is completed.
Futures:
Objects representing a delayed computation
Custom futures that implement the EsFuture interface may be integrated into the framework (@see @EsFuture-Interface category)
Turn any synchronous activity into an asynchronous activity (i.e. EsFuture on: [self doSyncActivity])
(Chainable) Create async call chains (i.e (future then: [:result1 | self doSomething(result1)]) then: [:result2 | ...)
@see EsFuture class comments for more details
Promises:
Objects that provide a future and is used to programmatically complete the future.
Can be used to convert callback style to async style
@see EsPromise class comments for more details
Async Exception Handling
Async equivalents of on:do: and ensure: are provided
Can signal arbitrary objects, in addition to other exceptions
All unhandled exceptions make their way to the EsAsyncUncaughtErrorHandler (logged to tty console by default)
Last modified date: 02/26/2021