WebAssembly / wasi-clocks

Clocks API for WASI
30 stars 12 forks source link

Change the clocks API from pseudo-handles to link-time authority #42

Closed sunfishcode closed 1 year ago

sunfishcode commented 1 year ago

Remove the wall-clock and monotonic-clock pseudo-handle types, and change now() and similar functions to be callable without any arguments.

For users that don't need multiple wall clocks or multiple monotonic clocks, this significantly simplifies the API.

For users that do need multiple wall clocks or multiple monotonic clocks at runtime, the component model could be extended to allow instances to be used as resources, which would allow any link-time authority API to be used through a handle. This seems like a better overall approach for WASI, as it means that many APIs won't need to decide between using handles for theoretical flexibility or using link-time authority for immediate usability. We can just use link-time authority when the immediate use cases want it, and use instance handles when the need arises to use them dynamically.