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

Order package manifest to start with the package declaration #682

Merged
merged 1 commit into from
Jan 26, 2024

Conversation

ahoppen
Copy link
Member

@ahoppen ahoppen commented Jan 25, 2024

Instead of starting with environment variable parsing, start with the actual package manifest, which is most likely the most interesting to most users.

As suggested in #680 (comment).

Instead of starting with environment variable parsing, start with the actual package manifest, which is most likely the most interesting to most users.
Copy link
Member

@allevato allevato left a comment

Choose a reason for hiding this comment

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

Looks great, thanks!

Copy link

@MahdiBM MahdiBM left a comment

Choose a reason for hiding this comment

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

I don't think this is possible to do with simple variables. See: swiftlang/swift#66045
Unless that bug is something even more complicated.

You can, however, use extensions to another type at the end of the file. Then use those declarations that are in the extensions higher up in the package constant.

@ahoppen
Copy link
Member Author

ahoppen commented Jan 26, 2024

That’s why all the variables are computed instead of stored, to work around the limitations of https://forums.swift.org/t/on-the-behavior-of-variables-in-top-level-code/52230.

@ahoppen ahoppen merged commit b9cb53f into swiftlang:main Jan 26, 2024
@ahoppen ahoppen deleted the ahoppen/re-order-package-manifest branch January 26, 2024 23:31
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.

3 participants