Skip to content
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

Async / Await / Generators / Coroutines in Plugins #702

Closed
vincent-lecrubier-skydio opened this issue Apr 8, 2024 · 4 comments
Closed

Comments

@vincent-lecrubier-skydio

Just discovered Extism today and it looks awesome!

One particular thing is missing for my use case: Support for Async / await / generators / coroutines in plugins. I don't see anything about this in the FAQ either. Have there been any thoughts about it?

@nilslice
Copy link
Member

nilslice commented Apr 8, 2024

Hi! Thanks for the kind words 😃

Which PDK language are you looking at with those limitations? JS?

@vincent-lecrubier-skydio
Copy link
Author

My main candidates for plugin languages are Python (doesn't exist yet, I know :-) ) with asyncio, JS with standard promises and generators, and Rust with tokio.

@YourTechBud
Copy link

YourTechBud commented Apr 16, 2024

I would like to add my usecase to this as well.

For me, my plugins need not be async. But they call a bunch of host functions which will be async. So technically the plugin would see all host functions as sync calls but the asynchronoucity would be provided by the host function and the host's runtime (tokio in my case)

@bhelx
Copy link
Contributor

bhelx commented Jun 14, 2024

This has been a tricky question for me because oftentimes, async / await does work at a syntax level in wasm, but not at a semantic level. The primary issue is wasm doesn't have the capability to support the underlying primitives just yet. There are some specs that I think will address this. but it may be a while before that makes it into all the runtimes and compilers.

In the meantime i definitely think we can do better at documenting what can be done and what can't. We're also working on encoding some common patterns people might have to deal with concurrency. Example: #696

For the time being, you can do things like @YourTechBud 's use case but you need to code it up yourself. Please share any experiences you have though, we'd love to formalize some more of these ideas.

@bhelx bhelx closed this as completed Jun 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants