NOTE
This is a work in progress idea
Grain Component
- new executable to ship with the compiler
- challenges
- recursion encoded as
lazy-{name}resource - polymorphic types (best option is to warn and omit)
- type parameters - case by case basis
- recursion encoded as
- output wit signature from a module signature
- first convert the typed signature into wit
Note: It may be smarted to use an ast more reflective of our format- Submodules
- So the entry module needs to describe a world
- I think submodules describe interfaces
- signature items
- types
- variants β
variantNote: Recurssion lazyiness neededsingletonβsingletonNote: Invesitage all singletons as flags
(a, b, ...rest)βtuple<a, b, ...rest>{ x, y, z }- We need to generate a new record for these ones and refer to it through our first tuple param
- records β these are translated directly into records
- open β
Throw warning - abstract β
Resource?????
- variants β
- values
functionglobal
- types
- type mappings
- functions
(a, b, c) => aβfunc(a, b, c) -> a
I donβt know how we should handle labeled args here - builtins
numberβ ?????BooleanβboolList<a>βlist<a>bytesβlist<u8>???
- functions
- then use smart-doc to output the wit in a formatted manner
- first convert the typed signature into wit
- generate an import based binding bridge
- recursion donβt implement the resource physically just use its encoding, when serializing and deserializing.
- check wit-bindgen grain and compare outputs to see
- use wasm-tools to validate + a jco test harness
- converting basic values like number
- packaging enums varaints
- function calls
grain component wit lib.grβ generate wit signature filegrain component bindingβ generate our wrapper entry pointgrain component compileβ compile our wrapper with your lib as input.