Skip to content

Commit 5098ffc

Browse files
committed
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 54d551f commit 5098ffc

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
@@ -361,18 +361,18 @@ Notes:
361361
value ::= t:<valtype> len:<uN> v:<val(t)> => (value t v) (where len = ||v||)
362362
val(bool) ::= 0x00 => false
363363
| 0x01 => true
364-
val(u8) ::= v:<core:byte> => (u8 v)
365-
val(s8) ::= v:<core:byte> => (s8 v) if v < 128 else (v - 256)
366-
val(s16) ::= v:<core:s16> => (s16 v)
367-
val(u16) ::= v:<core:u16> => (u16 v)
368-
val(s32) ::= v:<core:s32> => (s32 v)
369-
val(u32) ::= v:<core:u32> => (u32 v)
370-
val(s64) ::= v:<core:s64> => (s64 v)
371-
val(u64) ::= v:<core:u64> => (u64 v)
372-
val(f32) ::= v:<core:f32> => (f32 v) (if !isnan(v))
373-
| 0x00 0x00 0xC0 0x7F => (f32 nan)
374-
val(f64) ::= v:<core:f64> => (f64 v) (if !isnan(v))
375-
| 0x00 0x00 0x00 0x00 0x00 0x00 0xF8 0x7F => (f64 nan)
364+
val(u8) ::= v:<core:byte> => v
365+
val(s8) ::= v:<core:byte> => v if v < 128 else (v - 256)
366+
val(s16) ::= v:<core:s16> => v
367+
val(u16) ::= v:<core:u16> => v
368+
val(s32) ::= v:<core:s32> => v
369+
val(u32) ::= v:<core:u32> => v
370+
val(s64) ::= v:<core:s64> => v
371+
val(u64) ::= v:<core:u64> => v
372+
val(f32) ::= v:<core:f32> => v (if !isnan(v))
373+
| 0x00 0x00 0xC0 0x7F => nan
374+
val(f64) ::= v:<core:f64> => v (if !isnan(v))
375+
| 0x00 0x00 0x00 0x00 0x00 0x00 0xF8 0x7F => nan
376376
val(char) ::= b*:<core:byte>* => c (where b* = core:utf8(c))
377377
val(string) ::= v:<core:name> => v
378378
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
@@ -1371,18 +1371,18 @@ Components may define values in the value index space using following syntax:
13711371
```ebnf
13721372
value ::= (value <id>? <valtype> <val>)
13731373
val ::= false | true
1374-
| (u8 <core:u8>)
1375-
| (u16 <core:u16>)
1376-
| (u32 <core:u32>)
1377-
| (u64 <core:u64>)
1378-
| (s8 <core:s8>)
1379-
| (s16 <core:s16>)
1380-
| (s32 <core:s32>)
1381-
| (s64 <core:s64>)
1382-
| (f32 <f32canon>)
1383-
| (f32 nan)
1384-
| (f64 <f64canon>)
1385-
| (f64 nan)
1374+
| <core:u8>
1375+
| <core:u16>
1376+
| <core:u32>
1377+
| <core:u64>
1378+
| <core:s8>
1379+
| <core:s16>
1380+
| <core:s32>
1381+
| <core:s64>
1382+
| <f32canon>
1383+
| nan
1384+
| <f64canon>
1385+
| nan
13861386
| '<core:stringchar>'
13871387
| <core:name>
13881388
| (record <val>+)
@@ -1401,30 +1401,30 @@ The validation rules for `value` require the `val` to match the `valtype`. For
14011401
```wasm
14021402
(component
14031403
(value $a bool true)
1404-
(value $b u8 (u8 1))
1405-
(value $c u16 (u16 2))
1406-
(value $d u32 (u32 3))
1407-
(value $e u64 (u64 4))
1408-
(value $f s8 (s8 5))
1409-
(value $g s16 (s16 6))
1410-
(value $h s32 (s32 7))
1411-
(value $i s64 (s64 8))
1412-
(value $j f32 (f32 9.1))
1413-
(value $k f64 (f64 9.2))
1404+
(value $b u8 1)
1405+
(value $c u16 2)
1406+
(value $d u32 3)
1407+
(value $e u64 4)
1408+
(value $f s8 5)
1409+
(value $g s16 6)
1410+
(value $h s32 7)
1411+
(value $i s64 8)
1412+
(value $j f32 9.1)
1413+
(value $k f64 9.2)
14141414
(value $l char 'a')
14151415
(value $m string "hello")
1416-
(value $n (record (field "a" bool) (field "b" u8)) (record true (u8 1)))
1417-
(value $o (variant (case "a" bool) (case "b" u8)) (variant "b" (u8 1)))
1416+
(value $n (record (field "a" bool) (field "b" u8)) (record true 1))
1417+
(value $o (variant (case "a" bool) (case "b" u8)) (variant "b" 1))
14181418
(value $p (list (result (option u8)))
14191419
(list
14201420
error
1421-
(ok (some (u8 1)))
1421+
(ok (some 1))
14221422
(ok none)
14231423
error
1424-
(ok (some (u8 2)))
1424+
(ok (some 2))
14251425
)
14261426
)
1427-
(value $q (tuple u8 u16 u32) (tuple (u8 1) (u16 2) (u32 3)))
1427+
(value $q (tuple u8 u16 u32) (tuple 1 2 3))
14281428
14291429
(type $abc (flags "a" "b" "c"))
14301430
(value $r $abc (flags "a" "c"))
@@ -1457,7 +1457,7 @@ The validation rules for `value` require the `val` to match the `valtype`. For
14571457
(tuple
14581458
(record
14591459
(some "example")
1460-
(tuple (some (u8 42)) "hello")
1460+
(tuple (some 42) "hello")
14611461
)
14621462
(list 'a' 'b' 'c')
14631463
(flags "b" "a")

0 commit comments

Comments
 (0)