Skip to content

Functions of import of an import end up in bindings #184

@peter-facko

Description

@peter-facko

I am testing working with wasm components. I have four components, A, B1, B2, C with a diamond layout.

C
|\
| \
↓  ↓
B1 B2
 \ /
  ↓
  A

The packages are as follows

A:

package example:a@0.1.0;

interface %interface {
    record blob {
        x: f64,
    }

    f-a: func(x: f64) -> blob;
}

world %world {
    export %interface;
}

B1:

package example:b1@0.1.0;

interface %interface {
    use example:a/%interface@0.1.0.{blob};

    f-b1: func(x: f64) -> blob;
}

world %world {
    import example:a/%interface@0.1.0;

    export %interface;
}

B2:

package example:b2@0.1.0;

interface %interface {
    use example:a/%interface@0.1.0.{blob};

    f-b2: func(x: f64) -> blob;
}

world %world {
    import example:a/%interface@0.1.0;

    export %interface;
}

C:

package example:c@0.1.0;

interface %interface {
    f-c: func(x: f64) -> f64;
}

world %world {
    import example:b1/%interface@0.1.0;
    import example:b2/%interface@0.1.0;

    export %interface;
}

The generated bindings for C contain function f-a from A. I don't think that is correct. Is C allowed to call f-a in this example? I get that it needs the type blob, but why f-a? Isn't that an implementation detail of B1 and B2?

If this behavior is correct, how do I make importing A an implementation detail of B1 and B2? Can they still share A then?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions