You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Given that picos is intended as a common unopinionated foundation for other libraries to build on, I think Trigger.t (and thus subscribing on computations as well) should also allow for registering callbacks.
The reason is that callbacks, unlike effects (which are required to make await reasonably efficient), work on OCaml 4.xx, and they also work better if we need to interoperate with C code, Lwt, and other classic callback-based interfaces. Even a notion of future/promise that builds on computation (so as to be compatible with other libraries) might prefer the additional flexibility of callbacks. An example of use case for callbacks is tracing: on completion of the future we want to exit a given span, but we don't want the overhead of a full fiber to wait on that just to call exit_span.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Given that picos is intended as a common unopinionated foundation for other libraries to build on, I think
Trigger.t
(and thus subscribing on computations as well) should also allow for registering callbacks.The reason is that callbacks, unlike effects (which are required to make
await
reasonably efficient), work on OCaml 4.xx, and they also work better if we need to interoperate with C code, Lwt, and other classic callback-based interfaces. Even a notion of future/promise that builds oncomputation
(so as to be compatible with other libraries) might prefer the additional flexibility of callbacks. An example of use case for callbacks is tracing: on completion of the future we want to exit a given span, but we don't want the overhead of a full fiber to wait on that just to callexit_span
.Beta Was this translation helpful? Give feedback.
All reactions