Skip to content

Commit cdad9c3

Browse files
committed
Remove named multi-return from function types
1 parent 9d7f895 commit cdad9c3

File tree

3 files changed

+4
-13
lines changed

3 files changed

+4
-13
lines changed

design/mvp/Binary.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ resourcetype ::= 0x3f 0x7f f?:<funcidx>? => (resource (rep i32)
204204
functype ::= 0x40 ps:<paramlist> rs:<resultlist> => (func ps rs)
205205
paramlist ::= lt*:vec(<labelvaltype>) => (param lt)*
206206
resultlist ::= 0x00 t:<valtype> => (result t)
207-
| 0x01 lt*:vec(<labelvaltype>) => (result lt)*
207+
| 0x01 0x00 =>
208208
componenttype ::= 0x41 cd*:vec(<componentdecl>) => (component cd*)
209209
instancetype ::= 0x42 id*:vec(<instancedecl>) => (instance id*)
210210
componentdecl ::= 0x03 id:<importdecl> => id

design/mvp/Explainer.md

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -552,10 +552,7 @@ defvaltype ::= bool
552552
valtype ::= <typeidx>
553553
| <defvaltype>
554554
resourcetype ::= (resource (rep i32) (dtor async? <funcidx> (callback <funcidx>)?)?)
555-
functype ::= (func <paramlist> <resultlist>)
556-
paramlist ::= (param "<label>" <valtype>)*
557-
resultlist ::= (result "<label>" <valtype>)*
558-
| (result <valtype>)
555+
functype ::= (func (param "<label>" <valtype>)* (result <valtype>)?)
559556
componenttype ::= (component <componentdecl>*)
560557
instancetype ::= (instance <instancedecl>*)
561558
componentdecl ::= <importdecl>
@@ -690,13 +687,8 @@ The remaining 4 type constructors in `deftype` use `valtype` to describe
690687
shared-nothing functions, resources, components, and component instances:
691688

692689
The `func` type constructor describes a component-level function definition
693-
that takes and returns a list of `valtype`. In contrast to [`core:functype`],
694-
the parameters and results of `functype` can have associated names which
695-
validation requires to be unique. To improve the ergonomics and performance of
696-
the common case of single-value-returning functions, function types may
697-
additionally have a single unnamed return type. For this special case, bindings
698-
generators are naturally encouraged to return the single value directly without
699-
wrapping it in any containing record/object/struct.
690+
that takes a list of uniquely-named `valtype` parameters and optionally returns
691+
a `valtype`.
700692

701693
The `resource` type constructor creates a fresh type for each instance of the
702694
containing component (with "freshness" and its interaction with general

design/mvp/WIT.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1122,7 +1122,6 @@ param-list ::= '(' named-type-list ')'
11221122
11231123
result-list ::= ϵ
11241124
| '->' ty
1125-
| '->' '(' named-type-list ')'
11261125
11271126
named-type-list ::= ϵ
11281127
| named-type ( ',' named-type )*

0 commit comments

Comments
 (0)