From c81fbb2af4518d83a226961498fc085812107b55 Mon Sep 17 00:00:00 2001 From: Luke Wagner Date: Tue, 21 Jan 2025 18:12:49 -0600 Subject: [PATCH] Describe 'non-blocking' in WIT.md --- design/mvp/WIT.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/design/mvp/WIT.md b/design/mvp/WIT.md index f31fe772..0c3057a1 100644 --- a/design/mvp/WIT.md +++ b/design/mvp/WIT.md @@ -1309,6 +1309,17 @@ named-type-list ::= ϵ named-type ::= id ':' ty ``` +The optional `non-blocking` attribute on WIT function types indicates that the +callee *should not* block and thus the caller *should not* need to emit +asynchronous language bindings (e.g., in JS/Python/Rust, a `non-blocking` +function would emit a plain function instead of an `async` function). However, +`non-blocking` is just a hint and not enforced by the runtime and so it is +technically possible for the callee to block. In that case, though, it is the +*callee's* fault for any resultant loss of concurrency, not the caller's. Thus, +`non-blocking` is primarily intended to document expectations in a way that can +be taken advantage of by bindings generators. (For more details, see the +[async explainer](Async.md#sync-and-async-functions).) + ## Item: `use`