This would work great for strings but not so well for static arrays. Also, having an object property(offset) not be part of the object is very odd.
???
Maybe there is an additional way to define this which would make sense, but it does seem like having the memory involved in some way makes the most sense. Especially since in the future it will be possible to have N > 1 memories in a single binary.
Problem
There are currently two methods of encoding a Data Section entry into the binary. These are
const hello: i32 = 'Hello World!';
- static stringsconst array: i32[] = [1, 2, 3, 4];
- static array/raw data regionsIn both cases the data is encoded into the data section such that it'll take up the first available offset in memory.
The data sections in the WASM spec allow for an explicit offset. An example of this can be seen in the reference spec tests for data section here.
Goal
Define and implement a syntax for allowing an explicit offset to be defined when defining data sections in Walt.
Possible syntax:
A pseudo function call
This would require for altering the grammar to allow for top-level function calls, as well as some guards on calling non
memory.data()
function calls.A static object
This would work great for strings but not so well for static arrays. Also, having an object property(
offset
) not be part of the object is very odd.???
Maybe there is an additional way to define this which would make sense, but it does seem like having the
memory
involved in some way makes the most sense. Especially since in the future it will be possible to have N > 1 memories in a single binary.