-
-
Notifications
You must be signed in to change notification settings - Fork 4
Switch SideEffect
s to have any input be apart of their function
#13
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
Comments
Too unergonomic for actual use. Easier to write side effects, but writing side effects is on the rarer side, especially for the Rust implementation. |
I suppose we could also try to support an API like:
And then for one side effect we can add a convenience Might be able to integrate with the |
We could also ship a proc macro for side effects that allows us to do: let ((state, set_state), _) = register.state(1234).as_listener().complete(); To me, this is the best of all worlds. Won't require |
Changed my mind; this is too unergonomic and is hard to implement. It is still easier to just write out |
Uh oh!
There was an error while loading. Please reload this page.
As an alternative to #3, we could perhaps rewrite side effects to use a form of
fn as_listener(register: SideEffectRegistrar, _: ()) {}
.Then, you would do
register((as_listener, ()))
, orregister((effects::state, 1234), (effect2, ()))
.Not sure which approach I like better. Current approach requires more code indentation (returning a closure), but this one is forced to one side effect argument at all times, and requires wrapping everything in tuples.
The text was updated successfully, but these errors were encountered: