@@ -40,8 +40,8 @@ what type their custom descriptors have.
40
40
41
41
``` wasm
42
42
(rec
43
- (type $foo (descriptor $foo.rtt (struct (field ...) )))
44
- (type $foo.rtt (describes $foo (struct (field ...) )))
43
+ (type $foo (descriptor $foo.rtt) (struct (field ...)))
44
+ (type $foo.rtt (describes $foo) (struct (field ...)))
45
45
)
46
46
```
47
47
@@ -59,13 +59,13 @@ but type `$C` is different.
59
59
60
60
``` wasm
61
61
(rec
62
- (type $A (descriptor $A.rtt (struct (field i32) )))
63
- (type $A.rtt (describes $A (struct (field i32) )))
62
+ (type $A (descriptor $A.rtt) (struct (field i32)))
63
+ (type $A.rtt (describes $A) (struct (field i32)))
64
64
)
65
65
66
66
(rec
67
- (type $B (descriptor $B.rtt (struct (field i32) )))
68
- (type $B.rtt (describes $B (struct (field i32) )))
67
+ (type $B (descriptor $B.rtt) (struct (field i32)))
68
+ (type $B.rtt (describes $B) (struct (field i32)))
69
69
)
70
70
71
71
(rec
@@ -80,9 +80,9 @@ creating arbitrarily long chains of meta-descriptors:
80
80
81
81
``` wasm
82
82
(rec
83
- (type $foo (descriptor $foo.rtt (struct) ))
84
- (type $foo.rtt (describes $foo (descriptor $foo.meta-rtt (struct)) ))
85
- (type $foo.meta-rtt (describes $foo.rtt (struct) ))
83
+ (type $foo (descriptor $foo.rtt) (struct))
84
+ (type $foo.rtt (describes $foo) (descriptor $foo.meta-rtt) (struct))
85
+ (type $foo.meta-rtt (describes $foo.rtt) (struct))
86
86
)
87
87
```
88
88
@@ -97,8 +97,8 @@ which in turn must have a `descriptor` clause referring to the describing type.
97
97
``` wasm
98
98
(rec
99
99
(type $A (struct))
100
- (type $B (descriptor $C (struct) ))
101
- (type $C (describes $A (struct) )) ;; Invalid: must be 'describes $B'
100
+ (type $B (descriptor $C) (struct))
101
+ (type $C (describes $A) (struct)) ;; Invalid: must be 'describes $B'
102
102
)
103
103
```
104
104
@@ -116,15 +116,15 @@ This is the same strategy we use for ensuring supertype chains do not have cycle
116
116
``` wasm
117
117
(rec
118
118
;; Invalid describes clause: $self is not a previously defined type.
119
- (type $self (describes $self (descriptor $self (struct)) ))
119
+ (type $self (describes $self) (descriptor $self) (struct))
120
120
121
121
;; Invalid describes clause: $pong is not a previously defined type.
122
- (type $ping (describes $pong (descriptor $pong (struct)) ))
123
- (type $pong (describes $ping (descriptor $ping (struct)) ))
122
+ (type $ping (describes $pong) (descriptor $pong) (struct))
123
+ (type $pong (describes $ping) (descriptor $ping) (struct))
124
124
125
125
;; Invalid describes clause: $foo is not a previously defined type.
126
- (type $foo.rtt (describes $foo (struct) ))
127
- (type $foo (descriptor $foo.rtt (struct) ))
126
+ (type $foo.rtt (describes $foo) (struct))
127
+ (type $foo (descriptor $foo.rtt) (struct))
128
128
)
129
129
```
130
130
@@ -164,34 +164,34 @@ might be laid out after the engine-managed RTT for the type they describe.
164
164
165
165
``` wasm
166
166
(rec
167
- (type $super (sub (descriptor $super.rtt (struct) )))
168
- (type $super.rtt (sub (describes $super (struct) )))
167
+ (type $super (sub (descriptor $super.rtt) (struct)))
168
+ (type $super.rtt (sub (describes $super) (struct)))
169
169
170
170
;; Ok
171
- (type $sub (sub $super (descriptor $sub.rtt (struct) )))
172
- (type $sub.rtt (sub $super.rtt (describes $sub (struct) )))
171
+ (type $sub (sub $super (descriptor $sub.rtt) (struct)))
172
+ (type $sub.rtt (sub $super.rtt (describes $sub) (struct)))
173
173
)
174
174
175
175
(rec
176
176
(type $super (sub (struct)))
177
177
178
178
;; Ok
179
- (type $sub (sub $super (descriptor $sub.rtt (struct) )))
180
- (type $sub.rtt (describes $sub (struct) ))
179
+ (type $sub (sub $super (descriptor $sub.rtt) (struct)))
180
+ (type $sub.rtt (describes $sub) (struct))
181
181
)
182
182
183
183
(rec
184
- (type $super (sub (descriptor $super.rtt (struct ) )))
185
- (type $super.rtt (sub (describes $super (struct) )))
184
+ (type $super (sub (descriptor $super.rtt) (struct )))
185
+ (type $super.rtt (sub (describes $super) (struct)))
186
186
187
187
;; Ok (but strange)
188
188
(type $other (struct))
189
- (type $sub.rtt (sub $super.rtt (describes $other (struct) )))
189
+ (type $sub.rtt (sub $super.rtt (describes $other) (struct)))
190
190
)
191
191
192
192
(rec
193
- (type $super (sub (descriptor $super.rtt (struct) )))
194
- (type $super.rtt (sub (describes $super (struct) )))
193
+ (type $super (sub (descriptor $super.rtt) (struct)))
194
+ (type $super.rtt (sub (describes $super) (struct)))
195
195
196
196
;; Invalid: Must be described by an immediate subtype of $super.rtt.
197
197
(type $sub (sub $super (struct)))
@@ -201,12 +201,12 @@ might be laid out after the engine-managed RTT for the type they describe.
201
201
)
202
202
203
203
(rec
204
- (type $super (sub (descriptor $super.rtt (struct) )))
205
- (type $super.rtt (sub (describes $super (struct) )))
204
+ (type $super (sub (descriptor $super.rtt) (struct)))
205
+ (type $super.rtt (sub (describes $super) (struct)))
206
206
207
207
;; Invalid: $other.rtt must be a an immediate subtype of $super.rtt.
208
- (type $sub (sub $super (descriptor $other.rtt (struct) )))
209
- (type $other.rtt (describes $sub (struct) ))
208
+ (type $sub (sub $super (descriptor $other.rtt) (struct)))
209
+ (type $other.rtt (describes $sub) (struct))
210
210
)
211
211
```
212
212
@@ -226,10 +226,10 @@ This may be relaxed in the future.
226
226
``` wasm
227
227
(rec
228
228
;; Invalid: descriptor clauses may only be used with structs.
229
- (type $array (descriptor $array.rtt (array i8) ))
229
+ (type $array (descriptor $array.rtt) (array i8))
230
230
231
231
;; Invalid: describes clauses may only be used with structs.
232
- (type $array.rtt (describes $array (func) ))
232
+ (type $array.rtt (describes $array) (func))
233
233
)
234
234
```
235
235
@@ -242,11 +242,11 @@ this could allow the following unsound program to validate and run:
242
242
243
243
``` wasm
244
244
(rec
245
- (type $foo (sub (descriptor $foo.rtt (struct) )))
246
- (type $foo.rtt (sub (describes $foo (struct) )))
245
+ (type $foo (sub (descriptor $foo.rtt) (struct)))
246
+ (type $foo.rtt (sub (describes $foo) (struct)))
247
247
248
- (type $bar (sub $foo (descriptor $bar.rtt (struct (field $bar-only i32) ))))
249
- (type $bar.rtt (sub $foo.rtt (describes $bar (struct) )))
248
+ (type $bar (sub $foo (descriptor $bar.rtt) (struct (field $bar-only i32))))
249
+ (type $bar.rtt (sub $foo.rtt (describes $bar) (struct)))
250
250
)
251
251
252
252
(func $unsound (result i32)
@@ -486,12 +486,12 @@ WebAssembly.
486
486
;; counter.wasm
487
487
(module
488
488
(rec
489
- (type $counter (descriptor $counter.vtable (struct (field $val (mut i32) ))))
490
- (type $counter.vtable (describes $counter (struct
489
+ (type $counter (descriptor $counter.vtable) (struct (field $val (mut i32))))
490
+ (type $counter.vtable (describes $counter) (struct
491
491
(field $proto (ref extern))
492
492
(field $get (ref $get_t))
493
493
(field $inc (ref $inc_t))
494
- )))
494
+ ))
495
495
(type $get_t (func (param (ref null $counter)) (result i32)))
496
496
(type $inc_t (func (param (ref null $counter))))
497
497
)
@@ -683,12 +683,12 @@ and additionally expose a constructor:
683
683
684
684
(module
685
685
(rec
686
- (type $counter (descriptor $counter.vtable (struct (field $val (mut i32) ))))
687
- (type $counter.vtable (describes $counter (struct
686
+ (type $counter (descriptor $counter.vtable) (struct (field $val (mut i32))))
687
+ (type $counter.vtable (describes $counter) (struct
688
688
(field $proto (ref extern))
689
689
(field $get (ref $get_t))
690
690
(field $inc (ref $inc_t))
691
- )))
691
+ ))
692
692
(type $get_t (func (param (ref null $counter)) (result i32)))
693
693
(type $inc_t (func (param (ref null $counter))))
694
694
)
@@ -850,11 +850,11 @@ and is included below only to clarify the interaction between proposals.)
850
850
851
851
```
852
852
describedcomptype ::=
853
- | 0x4D x:typeidx ct:comptype => (descriptor x ct)
853
+ | 0x4D x:typeidx ct:comptype => (descriptor x) ct
854
854
| ct:comptype => ct
855
855
856
856
describingcomptype ::=
857
- | 0x4C x:typeidx ct:describedcomptype => (describes x ct)
857
+ | 0x4C x:typeidx ct:describedcomptype => (describes x) ct
858
858
| ct:describedcomptype => ct
859
859
860
860
sharecomptype ::=
0 commit comments