File 0531-Adjust-language-around-the-usage-of-receive-in-a-gen.patch of Package erlang
From 222ea7783fc70d65943aff08c310026fcf60dbfb Mon Sep 17 00:00:00 2001
From: Bryan Paxton <bryan@starbelly.io>
Date: Sun, 11 Sep 2022 15:02:30 -0500
Subject: [PATCH 1/8] Adjust language around the usage of receive in a
gen_statem.
- Change can not to should not and give a brief explanation of why
one should not use a receive in a gen_* process.
---
system/doc/design_principles/statem.xml | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/system/doc/design_principles/statem.xml b/system/doc/design_principles/statem.xml
index c53d569c99..7a8d9cee46 100644
--- a/system/doc/design_principles/statem.xml
+++ b/system/doc/design_principles/statem.xml
@@ -1912,9 +1912,14 @@ do_unlock() ->
to implicitly postpone any events to the <c>locked</c> state.
</p>
<p>
- A selective receive cannot be used from a <c>gen_statem</c>
+ A receive should not be used from a <c>gen_statem</c>
behaviour (or from any <c>gen_*</c> behaviour),
as the receive statement is within the <c>gen_*</c> engine itself.
+ Doing so without taking all cases into consideration could result
+ in system messages being discarded leading to unexpected behaviour.
+ Even if all cases are taken into consideration the recvieve would
+ still block system messages from arriving in a timely manor or
+ indefinitely if a timeout is not provided.
It must be there because all
<seeerl marker="stdlib:sys"><c>sys</c></seeerl>
compatible behaviours must respond to system messages and therefore
--
2.35.3