Class AsyncResult() Foundation

Implements asynchronous result processing with chain support.

Description

The AsyncResult class implements a powerful asynchronous programming model that supports two primary usage patterns:

1. Simple asynchronous result access through :wait() and :get() methods

2. Chain processing through :then(), :catch(), and :finally() methods

This class helps manage asynchronous operations by providing a standardized way to handle both successful results and error conditions. It allows operations to complete in the background while providing a consistent interface for accessing results when they become available.

An AsyncResult object begins in a waiting state and transitions to either a finished state (when completed successfully) or an error state (when an error occurs). The state transition is triggered by producer code calling either :signal() or :signalError().

Constructors
:new()
Initializes a new AsyncResult instance.
Methods
:catch()
Chains an error handler to execute when the operation fails.
:error()
Returns the error object if the operation failed.
:finally()
Chains a finalization handler to execute when the operation completes.
:get()
Gets the result value, blocking if not ready.
:signal()
Signals successful completion with a result value.
:signalError()
Signals an error condition with an error object.
:state()
Returns the current state of the AsyncResult.
:then()
Chains a success handler to execute when the operation completes.
:wait()
Waits for the operation to complete with optional timeout.
Feedback

If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.