Skip to content

Commit 6e35c8f

Browse files
committed
Rebase onto add-wit and update WIT.md
1 parent 4c19f5e commit 6e35c8f

File tree

1 file changed

+19
-14
lines changed

1 file changed

+19
-14
lines changed

design/mvp/WIT.md

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,7 @@ keyword ::= 'use'
104104
| 'string'
105105
| 'option'
106106
| 'list'
107-
| 'expected'
108-
| 'unit'
107+
| 'result'
109108
| 'as'
110109
| 'from'
111110
| 'static'
@@ -349,15 +348,15 @@ sleep: async func(ms: u64)
349348
Specifically functions have the structure:
350349

351350
```wit
352-
func-item ::= id ':' 'async'? 'func' '(' func-args ')' func-ret
351+
func-item ::= id ':' 'async'? 'func' func-tuple '->' func-tuple
353352
354-
func-args ::= func-arg
355-
| func-arg ',' func-args?
353+
func-tuple ::= ty
354+
| '(' func-named-type-list ')'
356355
357-
func-arg ::= id ':' ty
356+
func-named-type-list ::= nil
357+
| func-named-type ( ',' func-named-type )*
358358
359-
func-ret ::= nil
360-
| '->' ty
359+
func-named-type ::= id ':' ty
361360
```
362361

363362
## Item: `resource`
@@ -405,7 +404,7 @@ such as built-ins. For example:
405404

406405
```wit
407406
type number = u32
408-
type fallible-function-result = expected<u32, string>
407+
type fallible-function-result = result<u32, string>
409408
type headers = list<string>
410409
```
411410

@@ -418,11 +417,10 @@ ty ::= 'u8' | 'u16' | 'u32' | 'u64'
418417
| 'char'
419418
| 'bool'
420419
| 'string'
421-
| 'unit'
422420
| tuple
423421
| list
424422
| option
425-
| expected
423+
| result
426424
| future
427425
| stream
428426
| id
@@ -435,18 +433,25 @@ list ::= 'list' '<' ty '>'
435433
436434
option ::= 'option' '<' ty '>'
437435
438-
expected ::= 'expected' '<' ty ',' ty '>'
436+
result ::= 'result' '<' ty ',' ty '>'
437+
| 'result' '<' '_' ',' ty '>'
438+
| 'result' '<' ty '>'
439+
| 'result'
439440
440441
future ::= 'future' '<' ty '>'
442+
| 'future'
441443
442444
stream ::= 'stream' '<' ty ',' ty '>'
445+
| 'stream' '<' '_' ',' ty '>'
446+
| 'stream' '<' ty '>'
447+
| 'stream'
443448
```
444449

445450
The `tuple` type is semantically equivalent to a `record` with numerical fields,
446451
but it frequently can have language-specific meaning so it's provided as a
447452
first-class type.
448453

449-
Similarly the `option` and `expected` types are semantically equivalent to the
454+
Similarly the `option` and `result` types are semantically equivalent to the
450455
variants:
451456

452457
```wit
@@ -455,7 +460,7 @@ variant option {
455460
some(ty),
456461
}
457462
458-
variant expected {
463+
variant result {
459464
ok(ok-ty)
460465
err(err-ty),
461466
}

0 commit comments

Comments
 (0)