Open
Description
A newtype is a (mostly) zero-cost wrapper for an existing type. When it comes to the type stack, a newtype and its underlying type are indistinguishable. When it comes to certain interactions, they are very much distinguishable. In particular:
- On a call_indirect, newtypes of the expected function (as per type of the call_indirect) and of the passed function (as per type in function table) must match.
- Imports must also match newtypes.
So for example, a string-ptr newtype (i32) is just an i32 and can be manipulated and used like an i32, but a function that takes a string-ptr and a function that takes an i32 are not compatible.
Thoughts?
Metadata
Metadata
Assignees
Labels
No labels