-
Notifications
You must be signed in to change notification settings - Fork 98
Allow imports to name implementations #222
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
Conversation
|
After doing some more digging into semver constraints/ranges/comparators I want to point out a subtlety that wasn't obvious to me around matching against pre-release versions: By a naive application of semver's precedence rules, the range
I'm not sure what action to take here beyond being aware of this in tooling implementations. Maybe it would be worthwhile to add a note along the lines of "interpretation of |
|
Looks like no disagreement on the PR, so almost ready to merge. However, one more important use case came up recently in the context of registries (and, concretely, sharing component contents via OCI Registries) where one wants to name an implementation purely via its content hash without any additional URL or registry name (and where forcing a URL or registry name would just add a needless hoop to jump through). Thus, this commit adds a 5th implementation import case that has |
| | <name> <integrity> | ||
| | (locked-dep "<regid>" <integrity>?) | ||
| | (unlocked-dep "<regidset>") | ||
| regname ::= <namespace>+<label><projection>* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One thing I missed about this earlier is that this impacts syntax in WIT as well since it affects the (interface ..) production too, right? Would you be up for updating the WIT.md bits with this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, yes, thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Created #246
This PR extends the binary/text grammar of import names to allow imports to name not just interfaces, but also implementations. There are a number of ways to refer to an implementation (absolute URL, relative URL, precisely-versioned hierarchical name, version-ranged hierarchical name), so to keep things explicit (and avoid ad hoc string analysis) and support good bindings generation in the relevant cases, these cases are enumerated explicitly. (In the future, other cases could be added to
importnameas they present themselves.) Putting this semantic intent directly in the component binary allows it to be reliably interpreted by a variety of tools and runtimes, allowing better tooling interoperability than if a separate file or custom section was used.This PR doesn't add the new import name cases to Wit yet because there are some interesting related workflow questions that I expect influence how this looks in Wit, suggesting this be a follow-up, once we agree on the target grammar/information. Also, the expectation is that, for the most part, folks won't need to write this in Wit, these implementation imports will be added late by the toolchain based on build-config files or import maps.
Unfortunately, there doesn't seem to be an "obvious" production we can simply reuse for describing version ranges, so, with a lot of help and ideas from @lann, a basic syntax is proposed built on semver that hopefully looks intuitive enough, but feedback welcome on this of course.