Skip to content
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

Make imports part of the module header. #351

Merged
merged 2 commits into from
Jan 17, 2025
Merged

Make imports part of the module header. #351

merged 2 commits into from
Jan 17, 2025

Conversation

typeswitch-dev
Copy link
Contributor

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.
@typeswitch-dev typeswitch-dev enabled auto-merge (squash) January 17, 2025 17:39
@typeswitch-dev typeswitch-dev merged commit 9fea70f into main Jan 17, 2025
8 checks passed
@typeswitch-dev typeswitch-dev deleted the module-header branch January 17, 2025 18:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant