Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[proposal] Provided Effect Handlers #3946

Open
wants to merge 1 commit into
base: nightly
Choose a base branch
from

Conversation

owenhilyard
Copy link
Contributor

This proposal contains an alternative to an effect system which I think is more suitable for abstracting async, raises, and similar function colors in a systems language where the context may not always be suited to running arbitrary code. This is done by inverting the normal effect system, and having libraries provide the handlers based on information passed to them by the caller. Aside from the ability to manipulate function signatures with parameters (async, raises, and the return type), this can be implemented in Mojo today, but has substantial ergonomics issues. As such, I propose a place to put implicit parameters that not all functions will care about but should be propagated, such as division by zero handling, FP error handling, OOM, error handling behavior and async. With this, only functions which actually perform IO need to deal with async beyond awaiting functions they call (which does nothing for sync functions).

This proposal contains an alternative to an effect system which I think
is more suitable for abstracting `async`, `raises`, and similar function
colors in a systems language where the context may not always be suited
to running arbitrary code. This is done by inverting the normal effect
system, and having libraries provide the handlers based on information
passed to them by the caller. Aside from the ability to manipulate
function signatures with parameters (`async`, `raises`, and the return
type), this can be implemented in Mojo today, but has substantial
ergonomics issues. As such, I propose a place to put implicit parameters
that not all functions will care about but should be propagated, such as
division by zero handling, FP error handling, OOM, error handling
behavior and `async`. With this, only functions which actually perform
IO need to deal with async beyond awaiting functions they call (which
does nothing for sync functions).

Signed-off-by: Owen Hilyard <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant