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

Provide option to downgrade unknown import errors to warnings #56

Open
salmans opened this issue Feb 29, 2024 · 1 comment
Open

Provide option to downgrade unknown import errors to warnings #56

salmans opened this issue Feb 29, 2024 · 1 comment

Comments

@salmans
Copy link

salmans commented Feb 29, 2024

When instantiating a component, it's probably safe to supply it with additional imports that aren't declared in its world. For example, consider a component that declares an import foo in its world but it doesn't use foo in its implementation. Consequently, foo won't be present in the component's WIT that is generated by witgen, which will cause a confusing unknown import error by wac. I think downgrading the error to a warning would be enough to let the user know about a potential logical error while allowing wac to run successfully.

@rylev
Copy link
Collaborator

rylev commented Mar 22, 2024

I'm also running into this issue. For languages with good dead code elimination like Rust the resulting component binary might not reflect the exact targeted world if the any imports are not used - those imports will simply be removed. It would be nice if supply imports that don't exist was simply a warning as supplying an import that doesn't exist is essentially a noop.

Of course, this will largely go away with a programatic API where the actual world of the component can be dynamically inspected and only imports it actually requires can be provided.

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

2 participants