Skip to content

Implementing multiple worlds #203

Open

Description

@jsturtevant

It doesn't seem possible today to register multiple worlds. For instance, if I wanted my app to support both wasi:cli and wasi:http.

I thought it might be possible to create two different modules and then register them like:

    let rt = cli::bindings::register_host_functions(&mut sb, state);
    let rt = http::bindings::register_host_functions(&mut rt, state);

This doesn't work due to export WIT_WORLD which must be set to one and will only generate guest bindings for one of them.

The work around for now is combine the worlds into one world.

Activity

  1. changed the title [-]Implementing multple worlds[/-] [+]Implementing multiple worlds[/+] on Sep 17, 2025
  2. syntactically commented on Jan 22, 2026

    @syntactically
    Member

    Possibly related to this is the fact that each macro invocation generates new binding types, so you can't reuse an implementation from a previous invocation. This causes trouble for things like having a standard wasi:http or similar implementation available as a library. I think the solution is probably to add support to the macro for redirecting the type hierarchy to some other bindings module that was generated in the past for individual WIT packages, so that you can say "hey, use wasi_http_library::bindings::whatever for wasi:http/whatever, instead of generating it here".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions