Skip to content

Commit 30761ad

Browse files
committed
Integrate review feedback into Interfaces section
1 parent 59430a8 commit 30761ad

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

component-model/src/design/interfaces.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ Interfaces are based on the idea of [design by contract][wp-contract].
44
In software design, a _contract_ is a specification
55
of how a unit of code should behave.
66

7+
Concretely, an interface is a collection of type definitions
8+
and function declarations.
79
Conceptually, an _interface_ describes a single-focus, composable contract
810
through which components can interact with each other
911
and with hosts.
@@ -29,11 +31,15 @@ For example:
2931
along with definitions of types representing
3032
incoming requests, outgoing responses,
3133
HTTP methods and headers, and other data structures.
34+
This might look like the `incoming-handler` interface
35+
in [wasi-http][wasi-http-handler]
3236
* A "wall clock" interface might declare two functions,
3337
one to get the current time
3438
and one to get the granularity of the timer (whether time
3539
is measured in seconds, milliseconds, nanoseconds, or another unit).
3640
It would also define a type to represent an instant in time.
41+
This might look like the `wall-clock` interface
42+
in [wasi-clocks][wasi-clocks-wall-clock].
3743

3844
As an example of composing interfaces together,
3945
imagine defining a "timer" interface that declares two functions,
@@ -47,5 +53,7 @@ and imports anything imported by the "wall clock" interface.
4753
Interfaces are defined using [the WIT language](./wit.md).
4854

4955
[wp-contract]: https://en.wikipedia.org/wiki/Design_by_contract
56+
[wasi-http-handler]: https://github.com/WebAssembly/wasi-http/blob/main/wit/handler.wit
57+
[wasi-clocks-wall-clock]: https://github.com/WebAssembly/wasi-clocks/blob/main/wit/wall-clock.wit
5058

5159
> For a more formal definition of an interface, take a look at the [WIT specification](https://github.com/WebAssembly/component-model/blob/main/design/mvp/WIT.md).

0 commit comments

Comments
 (0)