-
Notifications
You must be signed in to change notification settings - Fork 90
Clarify usage patterns for feature gates #382
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
Comments
cc @yoshuawuyts as well |
Great points and thanks for the clear writeup! Agreed this does seem like an important issue to clarify in WIT.md. My initial impression is that we need to define some validation criteria on top of our current WIT grammar for gates to reject the following cases:
(Multiple With these restrictions, the OR option (1) you listed above I think gets simpler to think about: a feature is enabled if any of its In terms of the expected evolution of a feature, I agree that, for a WIT package author, the first step is At least that's my current working understanding. It might not be right though; happy to hear what others think. |
Waiting to hear what others think but wanted to comment on this:
This is quite a new use-case for me but in talking about version stuff yesterday (and during the package SIG meeting) it did occur to me -- right now it seems to me that there's one way for developers to "choose" a version: pulling in the WIT file(s) with the right package version at the top. Just to make sure we're on the same page -- are we talking here about about a future where some build tool allows a user to choose a different package version despite what is written in the local WIT, explicitly? Is this the unevenly-distributed present somewhere already? |
Ah yeah this is something different from what I was assuming as well. I've not considered the ability of a developer to, for example, locally have WASI 0.2.3 and then say "I'd like to target 0.2.1 instead". Rather the developer would be required to download WASI 0.2.1 WITs instead. Personally I think it's a big can of worms to try to view newer versions of files as-if they were older versions of files and it's more robust to use the exact copies of the older files as they were. |
Ah thanks, that's very helpful. I had forgotten that we (now) have a versioned repository of WIT packages (and was imagining the toolchain just had a single most-recent-version and could "backdate" to older versions by subtracting Ok, so in that case, if |
I think it's reasonable to say |
|
Oops, sorry, I forgot about |
A bit late here but looks like we hit consensus here, thanks ya'll -- I'll make the change to the |
Hey all, after some discussion in the following PRs:
bytecodealliance/wasm-tools#1689
bytecodealliance/jco#459
It seems like now would be a good time to discuss and really pin down the expected usage pattern of feature gates.
Intuitions seem to clash on how the gates should be used, so the decision should likely be discussed and made (hopefully quickly, if possible!) with a record for people to see the whys.
Context
At present, the WIT design feature gates section describes a reality that requires/implies a few things:
1. Package versions may not be present
There is no mention that a package containing
@since()
that is not itself versioned is a bug.There are currently some tests in
wasm-tools
that use@since
in packages that have no version specified (i.e. this is expected to be "right" or at least legal).2.
@since(version = v, feature = f)
works as an ORThis necessarily means that version is used or the feature is used.
**3.
@since()
may specify versions in the futureThe first part of this "if" can only work if you were able to specify a future (unreleased) version. It doesn't make sense to describe it like this unless a situation like this is possible:
Options for moving forward
There seem to be at least these three ways of handling it:
1. OR (current)
In this situation, we keep the functionality as it exists now. This requires the caveats mentioned above.
One of the questions associated with this approach is whether it makes sense for a package at version
0.1.0
to be able to have a@since(version = 0.2.0)
in it at all.2. AND (new)
In this situation
version
andfeature
are always both considered for enabling an item.This has a few benefits I can think of:
@since
related options makes it easy to do things like infer requirements from an import (versus not knowing if that means you need a version or a feature)3. Strict
@unstable
->@since
with ignored features after stabilizationAlex has laid out his intuition for this, which makes also makes sense.
Strictly moving from
@unstable
to@since
and then ignoring features once enabled, along with making sure that future unreleased versions cannot be used in@since
removes a lot of ambiguity.What needs to be clarified
It would be nice if we could lay out the actual intended evolution of a feature through gates -- this is kind of already spelled out already in the WIT design doc, but there seems to be two levels of progression here:
I think we're done at the point when we have:
@unstable
->@since
,@since(version = v)
->@since(version = v + 1)
?)The text was updated successfully, but these errors were encountered: