summaryrefslogtreecommitdiff
path: root/system
diff options
context:
space:
mode:
authorBjörn Gustavsson <bjorn@erlang.org>2023-04-13 10:13:32 +0200
committerGitHub <noreply@github.com>2023-04-13 10:13:32 +0200
commit3c81db12d47f39cead1cbf852707ea29ce210c22 (patch)
tree34486d3eaeb6d5463e8f9ac55839e04daa165d89 /system
parente5f8ee98f3cf9475d2430a444078fc49b4b8cbb6 (diff)
parentce6d9a8377ba80f4635df09c0110a39cceddd995 (diff)
downloaderlang-3c81db12d47f39cead1cbf852707ea29ce210c22.tar.gz
Merge pull request #7097 from RobinMorisset/doc
Document the scoping rules for try/catch/of/after expressions
Diffstat (limited to 'system')
-rw-r--r--system/doc/reference_manual/expressions.xml15
1 files changed, 14 insertions, 1 deletions
diff --git a/system/doc/reference_manual/expressions.xml b/system/doc/reference_manual/expressions.xml
index 34e622a67e..6b3ba96b6b 100644
--- a/system/doc/reference_manual/expressions.xml
+++ b/system/doc/reference_manual/expressions.xml
@@ -1938,6 +1938,20 @@ catch
exit:Reason -> {'EXIT',Reason}
error:Reason:Stk -> {'EXIT',{Reason,Stk}}
end</code>
+
+ <p>Variables bound in the various parts of these expressions have different scopes.
+ Variables bound just after the <c>try</c> keyword are:</p>
+ <list type="bulleted">
+ <item>bound in the <c>of</c> section</item>
+ <item>unsafe in both the <c>catch</c> and <c>after</c> sections, as well as after the whole construct</item>
+ </list>
+ <p>Variables bound in <c>of</c> section are:</p>
+ <list type="bulleted">
+ <item>unbound in the <c>catch</c> section</item>
+ <item>unsafe in both the <c>after</c> section, as well as after the whole construct</item>
+ </list>
+ <p>Variables bound in the <c>catch</c> section are unsafe in the <c>after</c> section, as well as after the whole construct.</p>
+ <p>Variables bound in the <c>after</c> section are unsafe after the whole construct.</p>
</section>
<section>
@@ -2426,4 +2440,3 @@ KeyPattern := ValuePattern &lt;- MapExpression</pre>
* 1:7: syntax error before: '&lt;'</pre>
</section>
</chapter>
-