Skip to content
This repository was archived by the owner on Apr 25, 2025. It is now read-only.

Add prose for typing rule of try-delegate. #237

Merged
merged 2 commits into from
Nov 17, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions document/core/valid/instructions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1415,20 +1415,29 @@ Control Instructions
:math:`\TRY~\blocktype~\instr^\ast~\DELEGATE~l`
...............................................

.. todo::
Add prose.
* The label :math:`C.\CLABELS[l]` must be defined in the context.

* The :ref:`block type <syntax-blocktype>` must be :ref:`valid <valid-blocktype>` as some :ref:`function type <syntax-functype>` :math:`[t_1^\ast] \to [t_2^\ast]`.

* Let :math:`C'` be the same :ref:`context <context>` as :math:`C`, but with the :ref:`result type <syntax-resulttype>` :math:`[t_2^\ast]` prepended to the |CLABELS| vector.

* Under context :math:`C'`,
the instruction sequence :math:`\instr^\ast` must be :ref:`valid <valid-instr-seq>` with type :math:`[t_1^\ast] \to [t_2^\ast]`.

.. math::
\frac{
C \vdashblocktype \blocktype : [t_1^\ast] \to [t_2^\ast]
\qquad
C,\CLABELS\,[t_2^\ast] \vdashinstrseq \instr^\ast : [t_1^\ast]\to[t_2^\ast]
\qquad
C.\CLABELS[l] = [t^\ast]
C.\CLABELS[l] = [t_0^\ast]
}{
C \vdashinstrseq \TRY~\blocktype~\instr^\ast~\DELEGATE~l : [t_1^\ast]\to[t_2^\ast]
}

.. note::
The :ref:`label index <syntax-labelidx>` space in the :ref:`context <context>` :math:`C` contains the most recent label first, so that :math:`C.\CLABELS[l]` performs a relative lookup as expected.


.. _valid-throw:

Expand Down