Installing JavaScript event loop...
JavaScript event loop installed.
A
Uncaught Error: exit with exit code 0
WASIProcExit wasi.js:1
proc_exit wasi.js:1
main runtime.js:373
instantiate instantiate.js:60
init index.js:17
async* main.ts:141
what seems to happen is the process exits immediately as soon as it suspends for the first time. the default Cooperative Task Executor still seems to work, but obviously you cannot do much beyond the simplest toy examples with that mode.
i tried both --swift-sdk 6.2-RELEASE-wasm32-unknown-wasip1-threads and --swift-sdk 6.2-RELEASE-wasm32-unknown-wasip1 and got the same result.
Compatible with Swift 6.2.0, but doesn't work in Embedded Swift: non-async entrypoint in @main type, requires JavaScriptEventLoop.installGlobalExecutor() call. Your async functions have to be scheduled from an unstructured Task.
Compatible with both non-embedded and Embedded Swift, but requires development snapshots: async entrypoint in @main with typealias DefaultExecutorFactory = JavaScriptEventLoop at the top level, JavaScriptEventLoop.installGlobalExecutor() is not needed.
The reason is that default executors API did not land in 6.2.0 and Embedded Swift concurrency only works with that API (and requires a few other changes that weren't included in release/6.2).
I'd appreciate if you try the new default executors API in main and 6.2 development snapshots and file issues for all of the bugs you encounter, so that we get fixes out as early as possible.
unfortunately, this didn’t work for me at all. the code inside a (non-detached) child Task just never seems to run at all.
the code inside a detached child Task runs up until the first suspension point, which is usually a call to some @MainActor function, after which it never progresses. so that doesn’t work either. so i could not get any sort of pattern like this to work: