You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is a follow-up to #249 and discussion in today's component model
meeting to require semicolons after the `package` statement to ensure
it's consistent with all other "single line things" in the WIT format.
WIT packages can be defined in a collection of files and at least one of them
@@ -74,7 +74,7 @@ belong to an interface.
74
74
An example of an interface is:
75
75
76
76
```wit
77
-
package local:demo
77
+
package local:demo;
78
78
79
79
interface host {
80
80
log: func(msg: string);
@@ -98,7 +98,7 @@ An `interface` can contain [`use`][use] statements, [type][types] definitions,
98
98
and [function][functions] definitions. For example:
99
99
100
100
```wit
101
-
package wasi:filesystem
101
+
package wasi:filesystem;
102
102
103
103
interface types {
104
104
use wasi:clocks.wall-clock.{datetime};
@@ -135,7 +135,7 @@ equivalent of a `component` type in the component model. For example this
135
135
world:
136
136
137
137
```wit
138
-
package local:demo
138
+
package local:demo;
139
139
140
140
world my-world {
141
141
import host: interface {
@@ -165,7 +165,7 @@ Worlds can contain any number of imports and exports, and can be either a
165
165
function or an interface.
166
166
167
167
```wit
168
-
package local:demo
168
+
package local:demo;
169
169
170
170
world command {
171
171
import wasi:filesystem/filesystem;
@@ -187,7 +187,7 @@ Additionally interfaces can be defined inline with an explicit kebab-name that
187
187
avoids the need to have an out-of-line definition.
188
188
189
189
```wit
190
-
package local:demo
190
+
package local:demo;
191
191
192
192
interface out-of-line {
193
193
the-function: func();
@@ -209,7 +209,7 @@ In the component model imports to a component either use an ID or a
209
209
kebab-name, and in WIT this is reflected in the syntax:
210
210
211
211
```wit
212
-
package local:demo
212
+
package local:demo;
213
213
214
214
interface my-interface {
215
215
// ..
@@ -243,7 +243,7 @@ A World can be created by taking the union of two or more worlds. This operation
243
243
Below is a simple example of a world that includes two other worlds.
244
244
245
245
```wit
246
-
package local:demo
246
+
package local:demo;
247
247
248
248
// definitions of a, b, c, foo, bar, baz are omitted
249
249
@@ -283,7 +283,7 @@ world union-my-world {
283
283
The `include` statement also works with [WIT package](#wit-packages-and-use) defined below with the same semantics. For example, the following World `union-my-world-a` is equivalent to `union-my-world-b`:
284
284
285
285
```wit
286
-
package local:demo
286
+
package local:demo;
287
287
288
288
interface b { ... }
289
289
interface a { ... }
@@ -313,7 +313,7 @@ world union-my-world-b {
313
313
If two worlds shared the same set of import and export IDs, then the union of the two worlds will only contain one copy of this set. For example, the following two worlds `union-my-world-a` and `union-my-world-b` are equivalent:
314
314
315
315
```wit
316
-
package local:demo
316
+
package local:demo;
317
317
318
318
world my-world-a {
319
319
import a1;
@@ -342,7 +342,7 @@ When two or more included Worlds have the same name for an import or export that
342
342
The following example shows how to resolve name conflicts where `union-my-world-a` and `union-my-world-b` are equivalent:
343
343
344
344
```wit
345
-
package local:demo
345
+
package local:demo;
346
346
347
347
world world-one { import a: func(); }
348
348
world world-two { import a: func(); }
@@ -361,7 +361,7 @@ world union-my-world-b {
361
361
`with` cannot be used to rename IDs, however, so the following world would be invalid:
362
362
363
363
```wit
364
-
package local:demo
364
+
package local:demo;
365
365
366
366
interface a {
367
367
foo: func();
@@ -403,7 +403,7 @@ A `use` statement inside of an `interface` or `world` block can be used to
403
403
import types:
404
404
405
405
```wit
406
-
package local:demo
406
+
package local:demo;
407
407
408
408
interface types {
409
409
enum errno { /* ... */ }
@@ -425,7 +425,7 @@ Interfaces linked with `use` must be acyclic.
425
425
Names imported via `use` can be renamed as they're imported as well:
426
426
427
427
```wit
428
-
package local:demo
428
+
package local:demo;
429
429
430
430
interface my-host-functions {
431
431
use types.{errno as my-errno};
@@ -447,7 +447,7 @@ interface types {
447
447
}
448
448
449
449
// host.wit
450
-
package local:demo
450
+
package local:demo;
451
451
452
452
interface my-host-functions {
453
453
use types.{errno, size};
@@ -462,7 +462,7 @@ the same syntax is used in `import` and `export` directives:
462
462
463
463
```wit
464
464
// a.wit
465
-
package local:demo
465
+
package local:demo;
466
466
467
467
world my-world {
468
468
import host;
@@ -484,7 +484,7 @@ When referring to an interface an ID form can additionally be used to refer to
484
484
dependencies. For example above it was seen:
485
485
486
486
```wit
487
-
package local:demo
487
+
package local:demo;
488
488
489
489
world my-world {
490
490
import wasi:clocks/monotonic-clock;
@@ -497,7 +497,7 @@ This is the package identified by `wasi:clocks` and the interface
497
497
well:
498
498
499
499
```wit
500
-
package local:demo
500
+
package local:demo;
501
501
502
502
interface my-interface {
503
503
use wasi:http/types.{request, response};
@@ -510,7 +510,7 @@ If a package being referred to has a version number, then using the above syntax
510
510
so far it can get a bit repetitive to be referred to:
0 commit comments