effekt-lang / effekt-lang/effekt
Import and module are implemented counterintuitive
- Dominant language
- Scala
- Stars
- 469
- Forks
- 41
- Avg merge
- 1d 16h
- Merged PRs (30d)
- 23
Description
Currently, the import system seems to work like this:
The import "path" needs to be relative to the directory you call the effekt compiler from.
For example:
```
- root
- foo.effekt
- bar.effekt
```
foo.effekt:
```
module root/foo
def foo() = ()
```
bar.effekt
```
module root/bar
import root/foo
def bar() = foo()
```
Running this from root will with:
`PATH\root> effekt bar.effekt`
will lead to:
`bar.effekt:2:1: Cannot find source for root/foo`
But will work when run from `PATH`
This is not intuitive and leads to long `import` and `module` statements.
### Solution
I think the `module` statements should be relative to the folder the effekt file lives in. So there is a mapping between folders and modules. The module's child and parent relationship corresponds to the folder hierarchy.
Import statement should import from the declared modules. The file should not need to know where the module is to import from it, otherwise it is counterintuitive to modules. Just as it works with the standard library.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.