Stream: wasm

Topic: Variable-interface component


view this post on Zulip Lachlan Gunn (Aug 14 2025 at 12:24):

Is there any existing way that one might build a component that can export a function having an indeterminate signature? We could obviously build a new component for each signature of interest and then link that in where it's needed, but for something like e.g. wrpc, it seems like it would be nice if it were possible to build a component that could be connected to any import, and that would get at runtime some representation of the types that it's been called with.

view this post on Zulip Lann Martin (Aug 14 2025 at 12:32):

There is not, and I'm not sure that the component model itself would ever support exactly what you are describing. You could certainly define an interface that provides this functionality, which would likely end up looking a lot like existing RPC systems with reflection interfaces.

view this post on Zulip Ralph (Aug 14 2025 at 12:38):

I mean, speaking as an old Microsoft-ee, you're free to reimplement IQueryInterface if you want, but ymmv: https://news.ycombinator.com/item?id=43021361

view this post on Zulip Ralph (Aug 14 2025 at 12:38):

We shall not be reimplementing DCOM, speaking for my MegaCorp. :-)

view this post on Zulip Ralph (Aug 14 2025 at 12:38):

but others can.....

view this post on Zulip Lachlan Gunn (Aug 14 2025 at 13:58):

Yeah, I was about five years too young to get into DCOM so don't know better. My thinking was that you could, in principle, create some adaptor module that could pull out the data directly and then transform it to a standard form before using the component model's lifting and lowering.

view this post on Zulip Lachlan Gunn (Aug 14 2025 at 14:00):

The thinking was that then you wouldn't need to somehow generate a monomorphised core module when linking in an RPC adaptor.

view this post on Zulip Till Schneidereit (Aug 19 2025 at 13:45):

My thinking was that you could, in principle, create some adaptor module that could pull out the data directly and then transform it to a standard form before using the component model's lifting and lowering.

this is one of the nice properties of the component model: exactly what you're describing here is possible today, without any special support by the component model itself. Obviously you either have to write the adapters by hand or have a tool generate them for you. But in either case, you can fully do it in your toolchain, without the runtime or the spec needing to support it in any way

view this post on Zulip Lann Martin (Aug 19 2025 at 13:55):

...and in case this isn't clear, you can do all this without source code; component binaries encode their own interface types.


Last updated: Dec 06 2025 at 05:03 UTC