WebAssembly / component-model

Repository for design and specification of the Component Model
Other
933 stars 79 forks source link

Current plans for async/future support #185

Closed philpax closed 1 year ago

philpax commented 1 year ago

Hi there!

I'm writing this to determine what the plans for async functions/future-returning functions in WIT are.

I know that #98 removed the async keyword in preparation for using future/stream return types, but I can't find any reference to future or stream in WIT.md (they seem to have been removed in https://github.com/WebAssembly/component-model/commit/778ab60c697da086ce4309ac7ef6cf1e57c09009).

Is this still something planned for the WIT MVP and/or the surrounding ecosystem (wit-bindgen/wasmtime)?

Thanks in advance!

lukewagner commented 1 year ago

Hi @philpax! Good question; we're currently working toward the "Preview 2" milestone that @sunfishcode presented here that includes resources and handles, but not the async types. Next, there is a "Preview 3" milestone (see slides in the TODO section) which is planned to add future and stream types to this repo, including WIT.md. Thus, in the Preview 2 timeframe, proposals like wasi-http are emulating async using resources and handles (e.g., see comments mentioning "Preview 3" here).

philpax commented 1 year ago

Fantastic, thank you! That answers all of my questions - hadn't seen the note about concurrency support at the end of WIT.md :)

It might be a good idea to detail the split between Preview 1/2/3 (or link the slides) in the README - I knew about them, but it'd completely slipped my mind that P3 was responsible for providing async support.

That being said, this issue should help others with the same question as me next time 😁

rsta79 commented 1 year ago

I'm wondering if there are any issues or updates related to the estimated release date of WASI. So far, I've only seen the release roadmap, which doesn't provide any estimated release date.

Also, I was wondering if it would be possible to create an adapter for compatibility, similar to the P1 to P2 upgrade. Will there be an adapter for adapting P2 to P3?

Thank you!

pchickey commented 1 year ago

We expect that the adapter for P2 to P3 will be an ordinary wasm component which exports the P2 interfaces and exports the P3 interfaces. The P1 to P2 adapter is a weird case because we can't use a component to provide the P1 interface, so we are doing very hacky stuff to link them into the same wasm module.

lukewagner commented 1 year ago

Finally got around to adding a note in #191, as suggested above.