diff --git a/design/mvp/WIT.md b/design/mvp/WIT.md index eec4b325..478c1143 100644 --- a/design/mvp/WIT.md +++ b/design/mvp/WIT.md @@ -65,8 +65,7 @@ WIT packages can be defined in a collection of files. At least one of these files must specify a package name. Multiple files can specify the `package`, though they must all agree on what the package name is. -Alternatively, many packages can be declared consecutively in one or more -files, if the "explicit" package notation is used: +Additionally, many packages can be declared consecutively in one or more files, if the following nested package notation is used: ```wit package local:a { @@ -78,6 +77,8 @@ package local:b { } ``` +It is worth noting that defining nested packages does not remove the need for the "root" package declaration above. These nested package definitions simply provide the contents of other packages inline so that they don't have to be otherwise resolved via the filesystem or a registry. + Package names are used to generate the [names of imports and exports] in the Component Model's representation of [`interface`s][interfaces] and [`world`s][worlds] as described [below](#package-format). @@ -890,36 +891,15 @@ readability but this isn't required. Concretely, the structure of a `wit` file is: ```ebnf -wit-file ::= explicit-package-list | implicit-package-definition -``` - -Files may be organized in two arrangements. The first of these is as a series -of multiple consecutive "explicit" `package ... {...}` declarations, with the -package's contents contained within the brackets. - -```ebnf -explicit-package-list ::= explicit-package-definition* - -explicit-package-definition ::= package-decl '{' package-items* '}' -``` - -Alternatively, a file may "implicitly" consist of an optional `package ...;` -declaration, followed by a list of package items. - -```ebnf -implicit-package-definition ::= package-decl? package-items* -``` +wit-file ::= package-decl? (package-items | nested-package-definition)* -These two structures cannot be mixed: a file may be written in either in the -explicit or implicit styles, but not both at once. +nested-package-definition ::= package-decl '{' package-items* '}' -All other declarations in a `wit` document are tied to a package, and defined -as follows. A package definition consists of one or more such items: - -```ebnf package-items ::= toplevel-use-item | interface-item | world-item ``` +Essentially, these top level items are [worlds], [interfaces], [use statements][use] and other package defintions. + ### Feature Gates Various WIT items can be "gated", to reflect the fact that the item is part of