@@ -4,6 +4,8 @@ Interfaces are based on the idea of [design by contract][wp-contract].
44In software design, a _ contract_ is a specification
55of how a unit of code should behave.
66
7+ Concretely, an interface is a collection of type definitions
8+ and function declarations.
79Conceptually, an _ interface_ describes a single-focus, composable contract
810through which components can interact with each other
911and 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
3844As an example of composing interfaces together,
3945imagine defining a "timer" interface that declares two functions,
@@ -47,5 +53,7 @@ and imports anything imported by the "wall clock" interface.
4753Interfaces 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