-
Notifications
You must be signed in to change notification settings - Fork 5
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
delay.wit #12
Comments
Thanks for the review! Currently, I have no experience yet with using |
wit defines an interface, not an implementation, so there is no way to specify that something is a wrapper around another interface. As we build out the Wasi ecosystem, we don't want to provide competing ways to do the same thing (in this case, suspend execution for some duration), because that makes it unclear to users which is the correct way to go about it. Since clocks and io are already standardized and available in various hosts and worlds, and consumed in various library code (e.g. wasi-libc, rust std, starlingmonkey etc), we don't want to create new worlds where those interfaces aren't available and instead some other interface is used to provide the same functionality - that would require a new target triple for toolchains to select a different implementation, and in general create confusion about what Wasi actually is. I'm not aware of any technical hurdles for providing an implementation of wasi-io, wasi-clocks, and wasi-i2c in any of the environments listed in the compatibility matrix, so we should move ahead assuming that io and clocks are used, and not specify an alternative. If we encounter some major problems with that approach during the implementation of this proposal, we can revisit that, but I think the burden of showing problems with re-using existing pieces of the wasi ecosystem should be quite high before we create any sort of alternative, due to the ecosystem effects of alternatives to these foundational pieces of our systems. |
The current wasi-i2c proposal is focused on synchronous I/O for now, which means it's essentially following the "simple" approach that, when Preview 3 async arives, will become a composable async API as well. The translation of If sleeping via wasi-clocks and wasi-io and pollables are easy to implement in the relevant contexts, then let's use them, but if it's a burden, I don't see it as essential for wasi-i2c to take on here. |
Reviewing this proposal, I saw https://github.com/WebAssembly/wasi-i2c/blob/main/wit/delay.wit for the first time.
This duplicates functionality already available through wasi-clocks.
wasi:clocks/monotonic-clock.subscribe-duration
gives awasi:io/poll.pollable
which becomes ready after a given duration, and the user can callpollable.block
to suspend execution until it is ready, or otherwise usewasi:io/poll.poll
to multiplex on many pollables.The text was updated successfully, but these errors were encountered: