WARDuino
WARDuino copied to clipboard
Block type collision
Block types may be expressed in one of two forms; (1) as a type index of an existing function type or (2) as a value type.¹
Currently the VM only supports the latter. (see WARDuino.cpp#L57) However, to avoid collision with the type indices, the value types are encoded as negative numbers. In WARDuino we only use unsigned integers. This means that simply adding type indices to the switch statement in the get_block_types function, like we did in commit fc5c1df5606ec428616fbb794d1e4c425ab2fc47, means collisions are technically possible.
How would we best resolve this?
¹ https://webassembly.github.io/spec/core/valid/types.html?highlight=block#block-types