wasm-tools
wasm-tools copied to clipboard
wit-component: Reactors should call `_initialize`
When using wasm-tools component new with --adapt pointed to a reactor adapter, it'd be great if _initialize was called in the resulting component, maybe via (start).
Currently, there's no way to access and call _initialize unless you specify it in a wit file, but that feels odd.
One of the main difficulties of _initialize-vs-(start) is that _initialize is separate from (start) to ensure that it's only invoked once all imports to the module are "ready". For components, for example, imports aren't ready when (start) is invoked meaning that we wouldn't be able to put _initialize there. That being said we could perhaps synthesize a second module which imports _initialize and is instantiated after all imports are "ready", and I think that'd be a reasonable change to make.
My apologies, I thought there was a component-level (start) as opposed to core wasm's, but I might have been mistaken. What I was hoping for is exactly what you mentioned.