Importation is done before type checking #288
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The current mechanism to import dependencies is done at runtime while type checking a term. Dependencies are imported on the fly.
This side-effect is convenient for prototyping, but has disadvantages. The main one being that the type checking and reduction produce both side-effects on the signature.
This raises several issues when Dedukti is used as a library via the modules in
api
folder.To overcome this, a way is to always ensure that modules are imported before type checking. This PR is a first step towards this goal:
REQUIRE
directive should be mandatory but I suspect this is a choice which will impact the standardisation of Dedukti so we make no commitment on it.Performance-wise, this MR has one main downside: terms are processed twice instead now. I suspect this is not sensible since in practice we spend most of our time doing reductions. However, this could be avoided if we solve 2. I have no benchmark to sustain this point at the moment.
TODO:
--no-implicit-import
to get the benefit of 2. without the downside of computing the dependencies introduced in this MR. If a dependency is missing, the type checking will just fail.