KarolS / KarolS/millfork

Customizable module export

Open
#96 0 comments 0 reactions 0 assignees View on GitHub
compiler enhancement
Dominant language
Scala
Stars
279
Forks
21
PR merge metrics
No merged PRs in 30d

Description

It would be nice if we could selectively `export` members of a given module. I think this would only have implications for the compiler itself, and any code should not care, as long as they're doing the right thing.

For example:

```
/// module1.mfk
export byte test = 1
```

```
/// module2.mfk
import module1

print(test)
```

```
/// module3.mfk
import module2

print(test)
^ Syntax error
```

This would also clean up naming collisions in some scenarios, as you can only have collisions if the values are exported, the modules imported, and they are named the same.

This does carry the side effect of `Program` not simply containing a flat list of the AST, as who imports what must be tracked and resolved.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.