-
Notifications
You must be signed in to change notification settings - Fork 3
Closed
Labels
Description
Current Rule S9.1 looks a bit too restrictive; in particular, it would require co_await on functions such as response.end() - which is not really necessary. So, the aim of this issue is to:
- preserve the rule "IF THERE CAN BE A SUDDEN STATE CHANGE WITHIN A FUNCTION CALL - THERE MUST BE AN EXPLICIT MARKER OF IT IN THE USER CODE"
- current S9.1 satisfies this (in this case marker is co_await itself), but it is sometimes too restrictive
- allow calling coroutines which CANNOT cause sudden state change, without co_await
- one example of such a function is response.end()
Proposed way to implement the aims above:
- allow to mark function calls (invocations) with [[nodecpp::no_await]] - (i.e. it can be EITHER co_await f() OR [[nodecpp::no_await]] f()).
- allow to mark function declarations with [[nodecpp::no_await]]; this MUST be allowed ONLY in "our" code (NOT in user code); such functions can be called as simply f()
A. We MUST NOT declare ANY coroutines which use co_await inside, as [[nodecpp::no_await]]
B. OTOH, ANY function which ONLY causes starting an async operation, and without ANY co_awaits inside, is safe to be marked as [[nodecpp::no_await]]. This includes response.end()
IMPORTANT: Implementing this issue REQUIRES changing STATIC-CHECKS.md accordingly