Stream: general

Topic: Why no recursive types in WIT/component model


view this post on Zulip Damian Reeves (Apr 05 2024 at 13:32):

The exclusion of recursion in types seems to make it impossible to model tree structures in WIT, or ASTS, or even a simple data format like JSON. Am I missing something? How would I define JSON or SExpressions in WIT?

view this post on Zulip Lann Martin (Apr 05 2024 at 13:34):

https://github.com/WebAssembly/component-model/issues/56

There was some discussion on recursive types in WebAssembly/interface-types#137. My takeaway was that recursion would be hard to specify with adapter functions. With adapters punted to a post-MVP p...

view this post on Zulip Damian Reeves (Apr 05 2024 at 13:35):

Thanks

view this post on Zulip Lann Martin (Apr 05 2024 at 13:39):

Depending on your exact requirements, the 3 alternatives I'd suggest are:

view this post on Zulip Ramon Klass (Apr 05 2024 at 14:24):

I'm using MessagePack because that is supported by several possible guest languages, but bincode is probably the most efficient format (rust only)

view this post on Zulip Karel Hrkal (kajacx) (Apr 13 2024 at 06:35):

I'm serializing a (possibly) recursive structure as JSON and sending a string across the wit boundary and it's working great.


Last updated: Oct 23 2024 at 20:03 UTC