-
-
Notifications
You must be signed in to change notification settings - Fork 266
Implement the new module system #2386
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
base: main
Are you sure you want to change the base?
Conversation
|
Do you have documentation or a sample model to demonstrate the new syntax? EDIT: Never mind, I figured it out from the test cases you wrote. |
|
@kgmt0 I played around with it for a bit, and so far I like the way it works and it seems very promising! Here are some issues I noticed:
Let me know if I need to clarify anything I said. |
|
Thanks for testing!
Hmm. I didn't consider having a special error message for that because libraries are not (currently) a value, but I can see how users would find it helpful. Would love to hear what other people think as well.
I agree. I plan to implement this but haven't got to it yet.
It's a bit different from other keywords because it only has a special meaning within the context of the libraries syntax. There's no problem if the user wants to name something "alias", or even use the word "alias" as an alias.
Good catch! I'll fix that.
There's a (not yet implemented)
Good point. I'll add some checks for that. |
I sent you a link to the design document on Slack. |
0cbc3b2 to
8c9e36f
Compare
3be88da to
3b6c687
Compare
a6ef635 to
aec791e
Compare
1918125 to
4b57666
Compare
This doesn't actually do anything useful yet.
This makes it possible to different procedures with the same name in different modules.
Also exclude globals, breeds, and breed variables from being imported.
Also set the module field of procedures imported with __includes to None since they're supposed to be in the namespace of the model.
Add a field that lists different aliases of a procedure to different variations of Procedure. This allows CompilerResult to generate the correct procedure map from lists of procedures.
Change the message to "Module {0} has already been imported".
Also update the module loading mechanism to use package metadata file to find module files.
This makes it possible to install packages through the extension manager.
Previously, relative imports only tries to load module files relative to the CWD. Fixes this so that it tries to load files relative to the importing module instead.
For identifiers that contain colons, its tokens will be merged so that they can be processed correctly by Namer.
Instead of prefixing the name with an underscore to avoid conflicts with reserved keywords, surround it with backticks instead.
Use stripMargin so that multiline strings used in test cases can be indented properly.
The new syntax looks something like this "import foo:bar as baz".
Remove this commit after testing is done.
This is still work-in-progress, but you can use it to load NLS files now. The
aliasoption that allows you to control how names are prefixed is also working.