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

Module System - Imports (bring): local .w files #476

Closed
staycoolcall911 opened this issue Nov 7, 2022 · 10 comments · Fixed by #3512
Closed

Module System - Imports (bring): local .w files #476

staycoolcall911 opened this issue Nov 7, 2022 · 10 comments · Fixed by #3512
Assignees
Labels
🛠️ compiler Compiler 📜 lang-spec-impl Appears in the language spec roadmap

Comments

@staycoolcall911
Copy link
Contributor

staycoolcall911 commented Nov 7, 2022

https://github.com/winglang/wing/blob/main/docs/04-reference/winglang-spec.md#4-module-system

This was done, then reverted - related to #401.

@staycoolcall911 staycoolcall911 added 📜 lang-spec-impl Appears in the language spec roadmap 🛠️ compiler Compiler labels Nov 7, 2022
@staycoolcall911 staycoolcall911 changed the title Bring: local .w files Module System - Imports (bring): local .w files Nov 7, 2022
@ekeren ekeren added the p3 label Nov 13, 2022
@eladb
Copy link
Contributor

eladb commented Dec 28, 2022

@staycoolcall911 is this something we are working on right now? Status is "in progress"...

@staycoolcall911
Copy link
Contributor Author

@3p3r added it in #252, but had to revert due to some bug and then we distracted him to some other tasks.
I'll verify with him what's the effort to finalize that.

@staycoolcall911
Copy link
Contributor Author

There's a branch where @3p3r started the work on that (2 commits):
https://github.com/winglang/wing/tree/sep/compiler-host

@github-actions
Copy link

Hi,

This issue hasn't seen activity in 60 days. Therefore, we are marking this issue as stale for now. It will be closed after 7 days.
Feel free to re-open this issue when there's an update or relevant information to be added.
Thanks!

@staycoolcall911
Copy link
Contributor Author

staycoolcall911 commented May 1, 2023

This is probably the p2 issue closest to p1 in terms of importance.
The motivation is that separating a wing project to multiple files can be a gateway to creating wing libraries, sharing wing code between users and projects. This will allow us to start developing a wing ecosystem.

This insight came from a discussion with @Chriscbr

@eladb
Copy link
Contributor

eladb commented May 1, 2023

Agreed.

@skorfmann
Copy link
Contributor

This would be quite nice to have. e.g. wrap this into a dedicated module so I don’t have to copy the class definition around.

@skorfmann
Copy link
Contributor

And just had another case where this would be handy

@eladb
Copy link
Contributor

eladb commented Jun 18, 2023 via email

@Chriscbr Chriscbr self-assigned this Jul 17, 2023
@mergify mergify bot closed this as completed in #3512 Jul 20, 2023
mergify bot pushed a commit that referenced this issue Jul 20, 2023
Introduce a basic form of multi-file Wing projects through the `bring` keyword. To use classes, interfaces, enums, or structs from another Wing file, bring a file with a path that ends in `.w`, and assign it to an alias:

```js
bring "./other-file.w" as shared;

new shared.Store();
```

This initial implementation follows a (naive) strategy of recursively instantiating the parser to create a large AST. This has some limitations -- for example it's not possible for two Wing files to reuse the same third Wing file -- but this still gives users a lot more refactoring power for building Wing apps. #3511 is the main follow-up issue for addressing this.

Closes #476

Follow up:
- #3509
- #3511

## Checklist

- [x] Title matches [Winglang's style guide](https://www.winglang.io/contributing/start-here/pull_requests#how-are-pull-request-titles-formatted)
- [x] Description explains motivation and solution
- [x] Tests added (always)
- [x] Docs updated (only required for features)
- [ ] Added `pr/e2e-full` label if this feature requires end-to-end testing

*By submitting this pull request, I confirm that my contribution is made under the terms of the [Monada Contribution License](https://github.com/winglang/wing/blob/main/CONTRIBUTION_LICENSE.md)*.
@monadabot
Copy link
Contributor

Congrats! 🚀 This was released in Wing 0.24.41.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🛠️ compiler Compiler 📜 lang-spec-impl Appears in the language spec roadmap
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

7 participants