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 β
variant
Note: Recurssion lazyiness needed
singleton
βsingleton
Note: 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
function
global
- 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
βbool
List<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.