The current explainer does not explicitly explain the text format for this proposal, but I propose that the text format for continuation type definitions be updated to this:
comptype_I ::= ... | '(' 'cont' (x,I'):typeuse_I ')' => (cont x), I'
Using the existing typeuse production and its abbreviation would allow all of these to be well-formed and valid:
(module
(type $f (func (param i32) (result i32))
(type $k1 (cont (type $f)))
(type $k2 (cont (type $f) (param i32) (result i32))) ;; Same as $k1
(type $k3 (cont (param i32) (result i32))) ;; Same as $k1 and $k2
(type $k4 (cont (param i64) (result i64))) ;; Implicitly defines a new function type
(type $k5 (cont)) ;; Implicitly defines a new function type
)
Notably the current text format (type $k (cont $f)) would no longer be correct, but the advantage would be that writing tests would become much simpler because the function types would not need to be separately defined. (This is about the text format only; the function type definition would still be separate in the binary format and abstract syntax.)
The current explainer does not explicitly explain the text format for this proposal, but I propose that the text format for continuation type definitions be updated to this:
Using the existing
typeuseproduction and its abbreviation would allow all of these to be well-formed and valid:Notably the current text format
(type $k (cont $f))would no longer be correct, but the advantage would be that writing tests would become much simpler because the function types would not need to be separately defined. (This is about the text format only; the function type definition would still be separate in the binary format and abstract syntax.)