Skip to content

Commit 88157cb

Browse files
rvolosatovslukewagner
authored andcommitted
revert: "include type in scalar value definitions"
This reverts commit 88e6d8f. After discussion we agreed that this is not required and parsers will have to rely on type information, however a "raw" byte value representation will be introduced in the text format for simplicity
1 parent ddccef9 commit 88157cb

File tree

2 files changed

+40
-40
lines changed

2 files changed

+40
-40
lines changed

design/mvp/Binary.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -358,18 +358,18 @@ Notes:
358358
value ::= t:<valtype> len:<uN> v:<val(t)> => (value t v) (where len = ||v||)
359359
val(bool) ::= 0x00 => false
360360
| 0x01 => true
361-
val(u8) ::= v:<core:byte> => (u8 v)
362-
val(s8) ::= v:<core:byte> => (s8 v) if v < 128 else (v - 256)
363-
val(s16) ::= v:<core:s16> => (s16 v)
364-
val(u16) ::= v:<core:u16> => (u16 v)
365-
val(s32) ::= v:<core:s32> => (s32 v)
366-
val(u32) ::= v:<core:u32> => (u32 v)
367-
val(s64) ::= v:<core:s64> => (s64 v)
368-
val(u64) ::= v:<core:u64> => (u64 v)
369-
val(f32) ::= v:<core:f32> => (f32 v) (if !isnan(v))
370-
| 0x00 0x00 0xC0 0x7F => (f32 nan)
371-
val(f64) ::= v:<core:f64> => (f64 v) (if !isnan(v))
372-
| 0x00 0x00 0x00 0x00 0x00 0x00 0xF8 0x7F => (f64 nan)
361+
val(u8) ::= v:<core:byte> => v
362+
val(s8) ::= v:<core:byte> => v if v < 128 else (v - 256)
363+
val(s16) ::= v:<core:s16> => v
364+
val(u16) ::= v:<core:u16> => v
365+
val(s32) ::= v:<core:s32> => v
366+
val(u32) ::= v:<core:u32> => v
367+
val(s64) ::= v:<core:s64> => v
368+
val(u64) ::= v:<core:u64> => v
369+
val(f32) ::= v:<core:f32> => v (if !isnan(v))
370+
| 0x00 0x00 0xC0 0x7F => nan
371+
val(f64) ::= v:<core:f64> => v (if !isnan(v))
372+
| 0x00 0x00 0x00 0x00 0x00 0x00 0xF8 0x7F => nan
373373
val(char) ::= b*:<core:byte>* => c (where b* = core:utf8(c))
374374
val(string) ::= v:<core:name> => v
375375
val(i:<typeidx>) ::= v:<val(type-index-space[i])> => v

design/mvp/Explainer.md

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1364,18 +1364,18 @@ Components may define values in the value index space using following syntax:
13641364
```ebnf
13651365
value ::= (value <id>? <valtype> <val>)
13661366
val ::= false | true
1367-
| (u8 <core:u8>)
1368-
| (u16 <core:u16>)
1369-
| (u32 <core:u32>)
1370-
| (u64 <core:u64>)
1371-
| (s8 <core:s8>)
1372-
| (s16 <core:s16>)
1373-
| (s32 <core:s32>)
1374-
| (s64 <core:s64>)
1375-
| (f32 <f32canon>)
1376-
| (f32 nan)
1377-
| (f64 <f64canon>)
1378-
| (f64 nan)
1367+
| <core:u8>
1368+
| <core:u16>
1369+
| <core:u32>
1370+
| <core:u64>
1371+
| <core:s8>
1372+
| <core:s16>
1373+
| <core:s32>
1374+
| <core:s64>
1375+
| <f32canon>
1376+
| nan
1377+
| <f64canon>
1378+
| nan
13791379
| '<core:stringchar>'
13801380
| <core:name>
13811381
| (record <val>+)
@@ -1394,30 +1394,30 @@ The validation rules for `value` require the `val` to match the `valtype`. For
13941394
```wasm
13951395
(component
13961396
(value $a bool true)
1397-
(value $b u8 (u8 1))
1398-
(value $c u16 (u16 2))
1399-
(value $d u32 (u32 3))
1400-
(value $e u64 (u64 4))
1401-
(value $f s8 (s8 5))
1402-
(value $g s16 (s16 6))
1403-
(value $h s32 (s32 7))
1404-
(value $i s64 (s64 8))
1405-
(value $j f32 (f32 9.1))
1406-
(value $k f64 (f64 9.2))
1397+
(value $b u8 1)
1398+
(value $c u16 2)
1399+
(value $d u32 3)
1400+
(value $e u64 4)
1401+
(value $f s8 5)
1402+
(value $g s16 6)
1403+
(value $h s32 7)
1404+
(value $i s64 8)
1405+
(value $j f32 9.1)
1406+
(value $k f64 9.2)
14071407
(value $l char 'a')
14081408
(value $m string "hello")
1409-
(value $n (record (field "a" bool) (field "b" u8)) (record true (u8 1)))
1410-
(value $o (variant (case "a" bool) (case "b" u8)) (variant "b" (u8 1)))
1409+
(value $n (record (field "a" bool) (field "b" u8)) (record true 1))
1410+
(value $o (variant (case "a" bool) (case "b" u8)) (variant "b" 1))
14111411
(value $p (list (result (option u8)))
14121412
(list
14131413
error
1414-
(ok (some (u8 1)))
1414+
(ok (some 1))
14151415
(ok none)
14161416
error
1417-
(ok (some (u8 2)))
1417+
(ok (some 2))
14181418
)
14191419
)
1420-
(value $q (tuple u8 u16 u32) (tuple (u8 1) (u16 2) (u32 3)))
1420+
(value $q (tuple u8 u16 u32) (tuple 1 2 3))
14211421
14221422
(type $abc (flags "a" "b" "c"))
14231423
(value $r $abc (flags "a" "c"))
@@ -1450,7 +1450,7 @@ The validation rules for `value` require the `val` to match the `valtype`. For
14501450
(tuple
14511451
(record
14521452
(some "example")
1453-
(tuple (some (u8 42)) "hello")
1453+
(tuple (some 42) "hello")
14541454
)
14551455
(list 'a' 'b' 'c')
14561456
(flags "b" "a")

0 commit comments

Comments
 (0)