bytecodealliance / preview2-prototyping

Polyfill adapter for preview1-using wasm modules to call preview2 functions.
Other
77 stars 20 forks source link

Remove resource abstraction from clocks #129

Closed pchickey closed 1 year ago

pchickey commented 1 year ago

At this time, we don't have use cases for providing multiple wall clocks or multiple monotonic clocks to the same component. So, according to the principle of following preview 1's design as close as possible, we are changing these interfaces to being provided by ambient functions, rather than methods on a resource.

Also, I fixed a typo bug in host where the monotonic clock's resolution method was implemented using now instead of resolution.

sunfishcode commented 1 year ago

Looks good. I'll propose this to the upstream wasi-clocks as well.

And as we discussed offline, the plan here is that in the future there will likely be use cases for multiple clocks, but it should be possible to model this in the component model in the future by having a way to treat a component instance as a resource that one can have handles to.