-
Notifications
You must be signed in to change notification settings - Fork 90
Interface version canonicalization #536
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
base: main
Are you sure you want to change the base?
Conversation
79c15f7
to
7b6bd7d
Compare
For the binary encoding the most straightforward option from a quick review would seem to be adding variants of
I suppose if we wanted to optimize the binary a bit this extra field could contain just the part of the original version that got lopped off by canonicalization. On this field width:
https://semver.org/#does-semver-have-a-size-limit-on-the-version-string
🤷 |
@lann Thanks for starting this! For the binary encoding question: yes, taking over the
Is there a simplicity argument to be made that requiring the concatenation of the |
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.
Looking good! A few drive-by comments:
export ::= (export <id>? "<exportname>" <sortidx> <externdesc>?) | ||
import ::= (import "<importname>" <fullversion>? bind-id(<externdesc>)) | ||
export ::= (export <id>? "<exportname>" <fullversion>? <sortidx> <externdesc>?) | ||
fullversion ::= (fullversion <valid semver>) |
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.
fullversion ::= (fullversion <valid semver>) | |
fullversion ::= (fullversion "<valid semver>") |
@@ -294,7 +294,7 @@ sort ::= core <core:sort> | |||
| type | |||
| component | |||
| instance | |||
inlineexport ::= (export <exportname> <sortidx>) | |||
inlineexport ::= (export <exportname> <fullversion>? <sortidx>) |
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.
inlineexport ::= (export <exportname> <fullversion>? <sortidx>) | |
inlineexport ::= (export "<exportname>" <fullversion>? <sortidx>) |
(pre-existing, but since we're touching this line)
importdecl ::= (import <importname> <fullversion>? bind-id(<externdesc>)) | ||
exportdecl ::= (export <exportname> <fullversion>? bind-id(<externdesc>)) |
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.
importdecl ::= (import <importname> <fullversion>? bind-id(<externdesc>)) | |
exportdecl ::= (export <exportname> <fullversion>? bind-id(<externdesc>)) | |
importdecl ::= (import "<importname>" <fullversion>? bind-id(<externdesc>)) | |
exportdecl ::= (export "<exportname>" <fullversion>? bind-id(<externdesc>)) |
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.
(pre-existing)
@@ -2379,6 +2383,33 @@ interpreted with the same [semantics][SemVerRange]. (Mostly this | |||
interpretation is the usual SemVer-spec-defined ordering, but note the | |||
particular behavior of pre-release tags.) | |||
|
|||
The `version` production used in `interfacename`s accepts both `valid semver` |
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.
Could you frame "canonicalized interface version" as a validation rule factored out into a new "Canonical Interface Name" section alongside and symmetric to "Name Uniquness" and say that it is temporarily not enforced but will start issuing warnings and be enforced post-Preview-3?
@@ -2283,10 +2284,13 @@ words ::= <word> | |||
| <words> '-' <word> | |||
projection ::= '/' <label> | |||
version ::= '@' <valid semver> |
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.
Probably good to rename this interfaceversion
since it's specific to interfacename
(and to be symmetric to pkgversion
). (I know that'll mess up the column alignment and fixing bloats the diff obscuring the change; maybe leave it unaligned and fix it right before merging.)
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, meant to "comment" not approve before it's even ready to review 🙃 )
For the binary encoding, here's another possible encoding:
maybe with affordances for rc/etc unsure. The basic idea though is that the actual import name would always be
For this I'd recommend using |
See #534
fullversion
in the import/export productions rather thaninterfacename
because I wanted it to be clear that it wouldn't be lowered into the core name.