-
Notifications
You must be signed in to change notification settings - Fork 126
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New module system #1363
New module system #1363
Conversation
When we resolve an undfined name we record error, but we continue processing things, so that we can report multiple errors. As a result we need to generate some sort of fake "real" name for the undefined entity. Previously we used to generate a fake local name, but that confused parts of the code that expected certain things to always be defined at the top level. So now we generate a fake name in the Cryptol prelude instead.
Why does this give me a dependency error?
Causes this error:
|
That would make the submodule |
It's interesting because this is how I imagine anonymous interfaces working implicitly i.e.
But I guess not quite
|
Indeed, the desugaring has to play some tricks to make sure that the anonymous interface module is defined "outside" the module that uses it. |
Why does this give me a
Whereas this does not give any errors?
Is it for a similar reason as we just discussed with the previous example of importing a local interface? |
@Riib11 I think this is due to the bug discussed yesterday on the channel---currently the desugaring for It is hard to know what's a good solution here, but the current idea is that we'll only move top-level imports to the new signature. @m-yac is working on implementing this I believe. Concretely, in your example, the new interface incorrectly gets the |
That all makes sense. Basically what I'm trying to accomplish is "functor eta-expansion" in order to allow a parametrized module B to be imported by another module A that is parametrized by the same (of perhaps some subset of) parameters. And even when this bug is fixed, it's still a little clunky to do this. |
Another way this could be thought of is as providing an interface as a module argument. For example
Here, the idea is that modules A much more convenient syntax for doing this would be the following, where the instantiated functor imports are currently in the works (as mentioned by @yav).
|
@Riib11 I just pushed the change @yav suggested - this example should work now. I also got a bunch more of the tests working. I think the only one that's still failing is
outputs
instead of what is used to, which was:
Any idea why this PR changes precedence behavior? There aren't even any modules or imports in this file. |
Unfortunately I'm having a different problem now. When I run
|
Can you make tickets if you find issues, so we can keep track of the various things that need fixing. Let's try to keep the PR comments for specific issues related to the code. |
# Conflicts: # CHANGES.md
Functors merge doc cleanup
# Conflicts: # cryptol-remote-api/src/CryptolServer/Names.hs
# Conflicts: # src/Cryptol/ModuleSystem/NamingEnv.hs
Previously it would contain everything in the prelude. Mostly this was not a problem because the usual use case for this is to find out the names of actual primitives, so having more in the mapping is not a problem. However, this accuracy is inconveninet, if you want to quickly look what's actually a primitive
The PrimMap is not actually so much a about primitives, as it is about "wired-in" names (i.e., built in names the Cryptol needs to refer to)
… an interface. This is a setp toward #1522
# Conflicts: # docs/RefMan/_build/doctrees/BasicSyntax.doctree # docs/RefMan/_build/doctrees/BasicTypes.doctree # docs/RefMan/_build/doctrees/Expressions.doctree # docs/RefMan/_build/doctrees/FFI.doctree # docs/RefMan/_build/doctrees/Modules.doctree # docs/RefMan/_build/doctrees/OverloadedOperations.doctree # docs/RefMan/_build/doctrees/RefMan.doctree # docs/RefMan/_build/doctrees/TypeDeclarations.doctree # docs/RefMan/_build/doctrees/environment.pickle # docs/RefMan/_build/html/.buildinfo # docs/RefMan/_build/html/BasicSyntax.html # docs/RefMan/_build/html/BasicTypes.html # docs/RefMan/_build/html/Expressions.html # docs/RefMan/_build/html/FFI.html # docs/RefMan/_build/html/Modules.html # docs/RefMan/_build/html/OverloadedOperations.html # docs/RefMan/_build/html/RefMan.html # docs/RefMan/_build/html/TypeDeclarations.html # docs/RefMan/_build/html/_static/basic.css # docs/RefMan/_build/html/_static/css/badge_only.css # docs/RefMan/_build/html/_static/css/theme.css # docs/RefMan/_build/html/_static/doctools.js # docs/RefMan/_build/html/_static/jquery.js # docs/RefMan/_build/html/_static/js/theme.js # docs/RefMan/_build/html/_static/searchtools.js # docs/RefMan/_build/html/_static/underscore.js # docs/RefMan/_build/html/genindex.html # docs/RefMan/_build/html/search.html # docs/RefMan/_build/html/searchindex.js
Cryptol's new module system rebased on top of
master
TODO