@@ -945,35 +945,37 @@ interface foo {
945
945
@since(version = "0.2.1")
946
946
b: func();
947
947
948
- @since(version = "0.2.2")
949
- @feature(name = "fancy-foo")
948
+ @since(version = "0.2.2", feature = "fancy-foo")
950
949
c: func();
951
950
952
- @feature(name = "fancier-foo")
951
+ @unstable(feature = "fancier-foo")
953
952
d: func();
954
953
}
955
954
```
956
955
The ` @since ` gate indicates that ` b ` and ` c ` were added as part of the ` 0.2.1 `
957
956
and ` 0.2.2 ` releases, resp. Thus, when building a component targeting, e.g.,
958
957
` 0.2.1 ` , ` b ` can be used, but ` c ` cannot. An important expectation set by the
959
- ` @since ` gate is that, once applied to an item, the item is never modified
958
+ ` @since ` gate is that, once applied to an item, the item is not modified
960
959
incompatibly going forward (according to general semantic versioning rules).
961
960
962
- In contrast, the lone ` @feature ` gate on ` d ` indicates that ` d ` is part of the
961
+ In contrast, the ` @unstable ` gate on ` d ` indicates that ` d ` is part of the
963
962
` fancier-foo ` feature that is still under active development and thus ` d ` may
964
963
change type or be removed at any time. An important expectation set by the
965
- ` @feature ` gate is that toolchains will not expose ` @feature ` -only-gated items
966
- by default unless explicitly opted-into by the developer.
964
+ ` @unstable ` gate is that toolchains will not expose ` @unstable ` features by
965
+ default unless explicitly opted-into by the developer.
967
966
968
967
Together, these gates support a development flow in which new features start
969
- with a ` @feature ` gate while the details are still being hashed out. Then, once
970
- the feature is stable (and, in a WASI context, voted upon), the ` @since ` gate
971
- can be added. To enable a smooth transition, both gates can be present at the
972
- same time, exposing the feature by when the target version is greater-or-equal.
973
- After a suitable transition period (during which producer toolchains bump their
974
- default target versions to enable the feature by default), the ` @feature ` gate
975
- can then be removed. Thus, in the above example, the ` fancy-foo ` feature gate
976
- could be removed from ` c ` once ` 0.2.2 ` is the default target version.
968
+ with an ` @unstable ` gate while the details are still being hashed out. Then,
969
+ once the feature is stable (and, in a WASI context, voted upon), the
970
+ ` @unstable ` gate is switched to a ` @since ` gate. To enable a smooth transition
971
+ (during which producer toolchains are targeting a version earlier than the
972
+ ` @since ` -specified ` version ` ), the ` @since ` gate contains an optional ` feature `
973
+ field that, when present, says to enable the feature when * either* the target
974
+ version is greator-or-equal * or* the feature name is explicitly enabled by the
975
+ developer. Thus, ` c ` is enabled if the version is ` 0.2.2 ` or newer or the
976
+ ` fancy-foo ` feature is explicitly enabled by the developer. The ` feature ` field
977
+ can be removed once producer toolchains have updated their default version to
978
+ enable the feature by default.
977
979
978
980
Specifically interfaces have the structure:
979
981
@@ -984,9 +986,11 @@ interface-item ::= 'interface' id '{' interface-items* '}'
984
986
985
987
interface-items ::= gate interface-definition
986
988
987
- gate ::= since-gate? feature-gate?
988
- since-gate ::= '@since' '(' 'version' '=' '"' <valid semver> '"' ')'
989
- feature-gate ::= '@feature' '(' 'name' '=' '"' id '"' ')'
989
+ gate ::= unstable-gate
990
+ | since-gate
991
+ unstable-gate ::= '@unstable' '(' feature-field ')'
992
+ feature-field ::= 'feature' '=' '"' id '"'
993
+ since-gate ::= '@since' '(' 'version' '=' '"' <valid semver> '"' ( ',' feature-field )? ')'
990
994
991
995
interface-definition ::= typedef-item
992
996
| use-item
@@ -1672,12 +1676,13 @@ standalone interface definitions (such `wasi:http/handler`) are no longer in a
1672
1676
` use ` s are replaced by direct aliases to preceding type imports as determined
1673
1677
by the WIT resolution process.
1674
1678
1675
- Unlike most other WIT constructs, the ` @feature ` and ` @version ` gates are not
1676
- represented in the component binary. Instead, these are considered "macro"
1677
- constructs that take the place of maintaining two copies of a single WIT document.
1678
- In particular, when encoding a collection of WIT documents into a binary, a target
1679
- version and set of feature names is supplied and determines whether individual
1680
- gated items are included or not.
1679
+ Unlike most other WIT constructs, the ` @since ` and ` @unstable ` gates are not
1680
+ represented in the component binary. Instead, they are considered "macro"
1681
+ constructs that take the place of maintaining two copies of a single WIT
1682
+ document. In particular, when encoding a collection of WIT documents into a
1683
+ binary, the target version and set of explicitly-enabled feature names
1684
+ determine whether individual gated features are included in the encoded type or
1685
+ not.
1681
1686
1682
1687
For example, the following WIT document:
1683
1688
``` wit
@@ -1712,5 +1717,5 @@ encoded as:
1712
1717
))
1713
1718
)
1714
1719
```
1715
- Thus, ` @since ` and ` @feature ` gates are not part of the runtime semantics of
1720
+ Thus, ` @since ` and ` @unstable ` gates are not part of the runtime semantics of
1716
1721
components, just part of the source-level tooling for producing components.
0 commit comments