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

Implement "defaulted" instantiation arguments #42

Open
peterhuene opened this issue Jan 25, 2024 · 0 comments
Open

Implement "defaulted" instantiation arguments #42

peterhuene opened this issue Jan 25, 2024 · 0 comments

Comments

@peterhuene
Copy link
Member

peterhuene commented Jan 25, 2024

If a component being instantiated with a new expression has a unlocked-dep or locked-dep import and the import has not been satisfied by an argument to the new expression, wac should implicitly resolve and instantiate a (shared) instance of the dependency and project into its exports, passing the result as the argument.

Example:

Package foo:bar:

(component
    // ...
   (export "f" (func 0))
)

Package bar:baz:

(component
  (import "unlocked-dep=<foo:bar/f@{>=0.1.0}>" (func))
)

Composition:

let i = new bar:baz { };

Then foo:[email protected] should get resolved and instantiated, f should be aliased from the export, and the alias passed in as the argument for unlocked-dep=<foo:bar/[email protected]>.

The instantiated dependency would either have all of its imports satisfied by implicit imports or by recursively instantiated dependencies for any unlocked-dep and locked-dep imports.

It would be an error if the (transitive) dependencies fail to resolve.

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