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

Add import system #544

Merged
merged 32 commits into from
Jul 5, 2024
Merged

Add import system #544

merged 32 commits into from
Jul 5, 2024

Conversation

LunaAmora
Copy link
Contributor

@LunaAmora LunaAmora commented Jun 5, 2024

Todo:

closes #514

Current syntax:

# A path starting with `./` or `..` will be imported relative to the file.
# Otherwise, the path will be relative to the folder of the main file.

# imports the `file` top level name from the file.bend, and all other names as 'file/name'
from path import file
import path/file

# imports the listed top level names
from path/file import a
from path/file import (a, b)
import (path/file/a, path/file/b)

# imports all names from the file
from path/file import *

# imports all `.bend` files from the folder
from path import *

# imports the `file` top level name from the file.bend aliased to `alias`, and all other names as 'alias/name'
from path import file as alias
import path/file as alias

# imports the listed top level names, each aliased to a new name
from path/file import a as A
from path/file import (a as A, b as B)
import (path/file/a as A, path/file/b as B)

@LunaAmora LunaAmora requested a review from developedby June 5, 2024 12:42
@LunaAmora LunaAmora self-assigned this Jun 5, 2024
@LunaAmora LunaAmora changed the title Add Import system Add import system Jun 5, 2024
@LunaAmora LunaAmora force-pushed the import-system branch 2 times, most recently from 3f7d34c to 37c5561 Compare June 10, 2024 15:52
@LunaAmora LunaAmora force-pushed the import-system branch 2 times, most recently from 01eec80 to 9233471 Compare June 19, 2024 13:35
@LunaAmora LunaAmora marked this pull request as ready for review June 19, 2024 15:59
src/imports.rs Outdated Show resolved Hide resolved
src/imports.rs Outdated Show resolved Hide resolved
Copy link
Member

@developedby developedby left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you write some documentation on how to use imports as a user?
With the namespace rules, etc.
It can go in the docs folder.

Also document the syntax on docs/syntax.md and add an entry in the changelog

@LunaAmora
Copy link
Contributor Author

Can you write some documentation on how to use imports as a user? With the namespace rules, etc. It can go in the docs folder.

Also document the syntax on docs/syntax.md and add an entry in the changelog

What to you mean by namespace rules?

@developedby
Copy link
Member

Can you write some documentation on how to use imports as a user? With the namespace rules, etc. It can go in the docs folder.
Also document the syntax on docs/syntax.md and add an entry in the changelog

What to you mean by namespace rules?

I mean how the path search correspond to names, what names are reachable, etc.

@LunaAmora
Copy link
Contributor Author

LunaAmora commented Jul 3, 2024

@developedby Could you review the docs/imports.md with the new changes? Later i'll finish the rebase so that it can be merged if no further changes are needed.

docs/imports.md Outdated Show resolved Hide resolved
docs/imports.md Show resolved Hide resolved
@developedby developedby added this pull request to the merge queue Jul 5, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to a conflict with the base branch Jul 5, 2024
@developedby developedby enabled auto-merge July 5, 2024 13:25
@developedby developedby added this pull request to the merge queue Jul 5, 2024
Merged via the queue into main with commit 57d6798 Jul 5, 2024
5 checks passed
@LunaAmora LunaAmora deleted the import-system branch July 5, 2024 13:35
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.

Don't warn on unused generated definitions
2 participants