Skip to content

Commit 18e4642

Browse files
committed
Make arrow mandatory in function types
1 parent 8f029a9 commit 18e4642

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

design/mvp/WIT.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -340,15 +340,15 @@ parameters, and results. Functions can optionally also be declared as `async`
340340
functions.
341341

342342
```wit
343-
thunk: func()
343+
thunk: func() -> ()
344344
fibonacci: func(n: u32) -> u32
345-
sleep: async func(ms: u64)
345+
sleep: async func(ms: u64) -> ()
346346
```
347347

348348
Specifically functions have the structure:
349349

350350
```wit
351-
func-item ::= id ':' 'async'? 'func' func-tuple ( '->' func-tuple )?
351+
func-item ::= id ':' 'async'? 'func' func-tuple '->' func-tuple
352352
353353
func-tuple ::= ty
354354
| '(' func-named-type-list ')'
@@ -481,22 +481,22 @@ by '-'s starts with a `XID_Start` scalar value with a zero Canonical Combining
481481
Class:
482482

483483
```wit
484-
foo: func(bar: u32)
484+
foo: func(bar: u32) -> ()
485485
486-
red-green-blue: func(r: u32, g: u32, b: u32)
486+
red-green-blue: func(r: u32, g: u32, b: u32) -> ()
487487
```
488488

489489
This form can't name identifiers which have the same name as wit keywords, so
490490
the second form is the same syntax with the same restrictions as the first, but
491491
prefixed with '%':
492492

493493
```wit
494-
%foo: func(%bar: u32)
494+
%foo: func(%bar: u32) -> ()
495495
496-
%red-green-blue: func(%r: u32, %g: u32, %b: u32)
496+
%red-green-blue: func(%r: u32, %g: u32, %b: u32) -> ()
497497
498498
// This form also supports identifiers that would otherwise be keywords.
499-
%variant: func(%enum: s32)
499+
%variant: func(%enum: s32) -> ()
500500
```
501501

502502
[kebab-case]: https://en.wikipedia.org/wiki/Letter_case#Kebab_case

0 commit comments

Comments
 (0)