You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently the way modules are loaded is a bit silly: when elaborating module definitions, if an import statement is found, it stops elaborating the current module and starts elaborating the imported module instead (unless it's already loaded). Instead of this, module loading should all happen at a top level, and module imports should be more about making namespaces visible between the various modules loaded at the top level. (Some experimentation is required to figure out how.)
The text was updated successfully, but these errors were encountered:
This PR changes the syntax of modules so that import statements can only appear in the module header, after the module statement. This is working towards issue #241 (avoid loading modules recursively).
In addition this PR also lets you optionally put dashes `--` after a module header to separate it from the module body. E.g.,
```
module mymodule.main
import std.prelude
import std.world
--
def main {
"Hello world!" print
}
```
This PR also adds a special error messages for `import` and `module` statements outside of module headers.
This PR changes the syntax of modules so that import statements can only
appear in the module header, after the module statement. This is working
towards issue #241 (avoid loading modules recursively).
In addition this PR also lets you optionally put dashes `--` after a
module header to separate it from the module body. E.g.,
```
module mymodule.main
import std.prelude
import std.world
--
def main {
"Hello world!" print
}
```
This PR also adds a special error messages for `import` and `module`
statements outside of module headers.
Currently the way modules are loaded is a bit silly: when elaborating module definitions, if an import statement is found, it stops elaborating the current module and starts elaborating the imported module instead (unless it's already loaded). Instead of this, module loading should all happen at a top level, and module imports should be more about making namespaces visible between the various modules loaded at the top level. (Some experimentation is required to figure out how.)
The text was updated successfully, but these errors were encountered: