New implementations of the static check for recursive definitions #1942
This GPR is on top of #1937.
This work was conducted by Alban Reynaud @Cemoixerestre during an internship at INRIA
A summary is included below. For more details, see
or the comments in the code itself, which has evolved a bit from
Rec_check is based on the idea of assigning "access modes" to variables
Before this patchset, the implementation (contributed by Jeremy Yallop)
and contexts Γ mapping variables to uses
The check relied on a judgment of the form
where, in the typing algorithm,
After this patchset, the implementation uses a simpler notion of context
and the judgment has the simpler structure
This patchset also fixes a soundness bug around
Another soundness bug found during this work was submitted and fixed
I would say that this would only be marginally easier than with the previous implementation; the big conceptual jump was @yallop's idea of using a type-system-like check, this one is easier to reason about than the one it replaces, but in both cases the idea would be to look at the typed derivations as evidence.
One thing that is rather easy to do in both cases is to get a sort of dependency order on the mutual declarations. This would allow accepting more things when a topological order is just not one big cycle. But I am not sure that it helps us make the current compilation scheme "more correct".
Thinking about compilation was on the list of things to do "if there is time" for Alban's internship, but this is a six-weeks end-of-bachelor internship, and there was no time.
2 times, most recently
Jul 30, 2018
In the description of the PR, you give a list of 4 modes (Dereference, Unguarded, Guard, Delay), but this does not seem to match the modes before the PR (3 modes, Dereferenced, Guarded, Unguarded) or in the PR (5 modes, Dereference, Return, Guard, Delay, Unused). Could you clarify?
@yallop: Thanks for the review! I did a pass over the patchset and took your comments into account.
There is one thing that we discussed with @Cemoixerestre but didn't have to work on: I believe that we can state (and prove easily by induction) meta-theorems of the following form: when
@gasche: there are some comments that don't have replies: here, here, here, and here. Could you please either leave a comment or mark the conversations as "resolved"? (I'm assuming that you've simply missed them, which is unfortunately very easy to do with GitHub's interface, because one of the comments is about a typo, which should be uncontroversial.)