Support for Implicit Imports #1341
-
I am working on implementing a language similar to Java, where I aim to offer implicit imports based on the type of grammar for I would appreciate guidance on the best approach to implement this functionality. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hey @we-wake-act21, when building a language with imports, the way to go is to create a dedicated global scope, see our own grammar language as an example. Once you have explicit imports available, implicit imports are just an extension of this mechanism. In addition to the explicit imports, you would find which documents in your workspace/stdlib are implicitly imported, and add the exported elements of these documents to the current global scope. |
Beta Was this translation helpful? Give feedback.
Hey @we-wake-act21,
when building a language with imports, the way to go is to create a dedicated global scope, see our own grammar language as an example. Once you have explicit imports available, implicit imports are just an extension of this mechanism. In addition to the explicit imports, you would find which documents in your workspace/stdlib are implicitly imported, and add the exported elements of these documents to the current global scope.