Skip to content

Commit af0c60e

Browse files
refactor: add notes about grammar & rules
Signed-off-by: Victor Adossi <[email protected]>
1 parent 9beb7d4 commit af0c60e

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

design/mvp/WIT.md

+10-1
Original file line numberDiff line numberDiff line change
@@ -953,7 +953,9 @@ Thus, `c` is enabled if the version is `0.2.2` or newer or the
953953
can be removed once producer toolchains have updated their default version to
954954
enable the feature by default.
955955

956-
Specifically, the syntax for feature gates is:
956+
#### Feature gate syntax
957+
958+
The grammar that governs feature gate syntax is:
957959

958960
```wit
959961
gate ::= gate-item*
@@ -969,6 +971,8 @@ feature-field ::= 'feature' '=' id
969971
version-field ::= 'version' '=' <valid semver>
970972
```
971973

974+
#### Rules for feature gate usage
975+
972976
As part of WIT validation, any item that refers to another gated item must also
973977
be compatibly gated. For example, this is an error:
974978

@@ -993,6 +997,11 @@ interface i {
993997
}
994998
```
995999

1000+
The following rules apply to the use of feature gates:
1001+
1002+
- Either `@since` *or* `@unstable` should be used, but not both (exclusive or).
1003+
- If a package contains a feature gate, it's version must be specified (i.e. `namespace:[email protected]`)
1004+
9961005
#### Scenario: Stabilization of a new feature
9971006

9981007
This section lays out the basic flow and expected usage of feature gate machinery

0 commit comments

Comments
 (0)