Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wit - documentation/examples for multiple export/imports #644

Open
artiemq opened this issue Feb 24, 2025 · 0 comments
Open

Wit - documentation/examples for multiple export/imports #644

artiemq opened this issue Feb 24, 2025 · 0 comments

Comments

@artiemq
Copy link

artiemq commented Feb 24, 2025

Hi! I’m exploring WASI and WIT and have some questions about it. I'd appreciate any clarifications

1. Can I import multiple components of the same interface into a single WebAssembly component?
For example, during a migration from one message queue (MQ) system to another, is it possible to import two message queue libraries of the same type (interface) (e.g., one for the old provider and one for the new) into the same component?

2. Is it possible for a WebAssembly component to export multiple components of the same type?
For exmple, during a MQ migration, could I export two message queue providers (one for each provider) from a single module?

3. Is there support for importing an array of components in WIT?
For example, could I import an array of middleware components for an HTTP service component?

4. Can a component export an array of components?
Similarly, is it possible to export an array of components, like an array of HTTP handlers?

5. How can I store data within a component itself?
It seems like components are designed to contain only logic. If that’s true, how would I implement something like an in-memory cache inside a component? Is there a mechanism to persist state or data within the component itself?
For example static configuration for some business logic

I couldn’t find any examples beyond the basic cases, but these seem like essential features for many applications, so there should be a way to make them work


I have a few more questions about wit-bindgen. I realize this might not be the best repo for these questions, but I’d be grateful if you could provide some clarifications

6. Why are some functionalities provided through bindings while others are built into languages standard features?
For example, why is printing to stdout available via the standard println!() macro, while other features (e.g., wasi:sql.readwrite/query) require bindings?

7. Why are Rust (and other languages) bindings provided as regular functions rather than traits with implementations?
The current approach makes it challenging to test components without introducing additional abstraction layers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant