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
Copy file name to clipboardExpand all lines: proposals/exception-handling/Exceptions-formal-overview.md
+18-20Lines changed: 18 additions & 20 deletions
Original file line number
Diff line number
Diff line change
@@ -25,7 +25,7 @@ instr ::= ... | throw x | rethrow l
25
25
Tags
26
26
27
27
```
28
-
tag ::= export* tag exntype | export* tag tagtype import
28
+
tag ::= export* tag tagtype | export* tag tagtype import
29
29
```
30
30
31
31
Modules
@@ -41,7 +41,9 @@ mod ::= module ... tag*
41
41
To verify that a `try...delegate l` instruction refers to a label surrounding the instructions of a try block (call this a try-label), introduce a `kind` attribute to labels in the validation context, which is set to `try` when the label is a try-label.
42
42
43
43
Similarly, to verify that the `rethrow l` instruction refers to a label surrounding the instructions of a catch block (call this a catch-label), we allow the `kind` attribute of labels in the validation context to be set to `catch` when the label is a catch-label.
The original notation `labels [t*]` is now an abbreviation for:
46
48
47
49
```
@@ -86,7 +88,7 @@ C ⊢ try bt instr* delegate l : [t1*]→[t2*]
86
88
Stores
87
89
88
90
```
89
-
S ::= {..., tags exninst*}
91
+
S ::= {..., tags taginst*}
90
92
```
91
93
92
94
Tag Instances
@@ -113,11 +115,9 @@ Block contexts and label kinds
113
115
So far block contexts are only used in the reduction of `br l` and `return`, and only include labels or values on the stack above the hole. If we want to be able to break jumping over try-catch and try-delegate blocks, we must allow for the new administrative control instructions to appear after labels in block contexts, mirroring the label kinds of labels in validation contexts.
S;C, labels [t*] ⊢ caught_m{a val^n} instr* end : []→[t'*]
201
200
```
202
201
203
202
By adding the attribute `kind` to labels, we are creating situations in the proof of type preservation, where we have a derivation of some `S;C, label [t*] ⊢ instr* : []→[t*]` but we need to have that `S;C, label {result [t*], kind <labelkind>} ⊢ instr* : []→[t*]` for some `<labelkind> ::= try | catch`. To resolve this we add the following typing rule for labels in the context, which ensures our newly introduced `try` and `catch` blocks can contain any instructions a regular block can.
0 commit comments