Skip to content

Module import paths #136

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

Open
ske2004 opened this issue May 7, 2022 · 1 comment
Open

Module import paths #136

ske2004 opened this issue May 7, 2022 · 1 comment
Labels
enhancement New feature or request

Comments

@ske2004
Copy link
Contributor

ske2004 commented May 7, 2022

Module import paths will allow to specify a path to load modules from.
It is similar to -I flag in C.
For example, this could be shortened:

import (
        "window.um"; "rect.um"; "th.um"; "canvas.um"; "utf8.um"; "image.um"
        "../../tophat.dat/d_font.um"; "../../tophat.dat/d_util.um"; "../../tophat.dat/d_pfx.um"
)

Into

import (
        "window.um"; "rect.um"; "th.um"; "canvas.um"; "utf8.um"; "image.um"
        "d_font.um"; "d_util.um"; "d_pfx.um"
)

By specifying import path:

umka -I ../../tophat.dat main.um

Specifying import path shall be possible through API.
Import paths are prioritized in order they are added.
We first check file near "main.um".
Then we start checking folders in the import paths, FIFO way, by checking first until last and finding if one matches, or error if no matches.

@ske2004
Copy link
Contributor Author

ske2004 commented Mar 21, 2024

Another option I thought of is this:

import ("umbox:tar/tar.um")
import ("src:d_util.um")

Essentially, namespaces for import directories. This case is better since there's a clear distinction, and umbox packages will be disambiguated from sources with same path.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants