You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 25, 2025. It is now read-only.
- Removes a link next to `[1]`. The link is also in the footnote so it's
not strictly necessary, and adding a link right next to `[1]` makes
`[]` disappear, so it appears as just `1`, which isn't probably what
the author intended.
- Both of `throw/catch x` and `throw/catch $x` are being used. Unified
them into `throw/catch $x`.
- Fixed a location of `$label2` in a test.
Copy file name to clipboardExpand all lines: proposals/exception-handling/Exceptions-formal-examples.md
+15-15Lines changed: 15 additions & 15 deletions
Original file line number
Diff line number
Diff line change
@@ -20,7 +20,7 @@ Note that the block contexts and throw contexts given for the reductions are the
20
20
21
21
The only example with an almost full reduction trace, and all new instructions. Such explicit reduction steps are only shown in Example 4 and Example 5, to highlight the reduction step of the administrative `delegate`.
22
22
23
-
In the following reduction, we don't show the first 4 steps, which just reduce the several `try`s and the `throw x` to their respective administrative instructions. The type of the tag `$x` here is `[]→[]`.
23
+
In the following reduction, we don't show the first 4 steps, which just reduce the several `try`s and the `throw $x` to their respective administrative instructions. The type of the tag `$x` here is `[]→[]`.
24
24
25
25
```
26
26
(tag $x)
@@ -153,11 +153,11 @@ Use the trivial throw context `T` again, this time to match the throw to the `ca
153
153
Location of a rethrown exception. Let `x, y, z` be tag indices of tags with type `[t_x]→[]`, `[t_y]→[]`, and `[t_z]→[]` respectively. Let `val_p : t_p` for every `p` among `x, y, z`.
154
154
155
155
```
156
-
try
156
+
try $label2
157
157
val_x
158
-
throw x
159
-
catch x
160
-
try $label2
158
+
throw $x
159
+
catch $x
160
+
try
161
161
val_y
162
162
throw y
163
163
catch_all
@@ -177,8 +177,8 @@ Folded it looks as follows.
177
177
(try
178
178
(do
179
179
val_x
180
-
(throw x))
181
-
(catch x ;; <--- (rethrow 2) targets this catch.
180
+
(throw $x))
181
+
(catch $x ;; <--- (rethrow 2) targets this catch.
182
182
(try
183
183
(do
184
184
val_y
@@ -222,7 +222,7 @@ This reduces to `val_x (throw a_x)`, throwing to the caller.
222
222
(func
223
223
try $label0
224
224
rethrow $label0 ;; cannot be done, because it's not within catch below
225
-
catch x
225
+
catch $x
226
226
end)
227
227
```
228
228
@@ -237,7 +237,7 @@ This is a validation error (no catch block at given rethrow depth).
237
237
```
238
238
(try $l
239
239
(do
240
-
(throw x))
240
+
(throw $x))
241
241
(delegate $l))
242
242
```
243
243
@@ -252,17 +252,17 @@ try $label1
252
252
try
253
253
try $label0
254
254
try
255
-
throw x
255
+
throw $x
256
256
delegate $label0 ;; delegate 0
257
257
delegate $label1 ;; delegate 1
258
258
catch_all
259
259
end
260
-
catch x
260
+
catch $x
261
261
instr*
262
262
end
263
263
```
264
264
265
-
In folded form and reduced to the point `throw x` is called, this is:
265
+
In folded form and reduced to the point `throw $x` is called, this is:
266
266
267
267
```
268
268
(label_0{}
@@ -295,7 +295,7 @@ The `delegate{ 1 }` reduces using the trivial throw context and the block contex
295
295
(catch_0{ a_x instr* }
296
296
(throw a_x) end) end)
297
297
```
298
-
The thrown exception is (eventually) caught by the outer try's `catch x`, so the above reduces to the following.
298
+
The thrown exception is (eventually) caught by the outer try's `catch $x`, so the above reduces to the following.
299
299
300
300
```
301
301
(label_0 {}
@@ -310,7 +310,7 @@ The thrown exception is (eventually) caught by the outer try's `catch x`, so the
Copy file name to clipboardExpand all lines: proposals/exception-handling/Exceptions-formal-overview.md
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -185,7 +185,7 @@ label_m{} B^l[ delegate{l} T[val^n (throw a)] end ] end
185
185
↪ val^n (throw a)
186
186
```
187
187
188
-
Note that the last reduction step above is similar to the reduction of `br l`[1](https://webassembly.github.io/spec/core/exec/instructions.html#xref-syntax-instructions-syntax-instr-control-mathsf-br-l), if we look at the entire `delegate{l}...end` as the `br l`, but also doing a throw after it breaks.
188
+
Note that the last reduction step above is similar to the reduction of `br l`[1], if we look at the entire `delegate{l}...end` as the `br l`, but also doing a throw after it breaks.
189
189
190
190
There is a subtle difference though. The instruction `br l` searches for the `l+1`th surrounding block and breaks out after that block. Because `delegate{l}` is always wrapped in its own `label_n{} ... end`[2], with the same lookup as for `br l` we end up breaking inside the `l+1`th surrounding block, and throwing there. So if that `l+1`th surrounding block is a try, we end up throwing in its "try code", and thus correctly getting delegated to that try's catches.
0 commit comments