Stream: general

Topic: The world name "root"


view this post on Zulip Yosh Wuyts (Apr 28 2026 at 11:07):

Is there anything special about the world name "root" for the entry point to a component? I'm looking at the C-A docs and there doesn't seem to be anything about that specifically?

view this post on Zulip Yosh Wuyts (Apr 28 2026 at 11:14):

I'm guessing it's mainly just a convention?

view this post on Zulip Yosh Wuyts (Apr 28 2026 at 11:16):

I'm asking because I'm wondering whether when visualizing component structures, we should consider "root" as an inherent part of the component itself, or perhaps as its own world. I'm assuming the latter?

view this post on Zulip Yosh Wuyts (Apr 28 2026 at 11:17):

But if that's the case, then I'm confused how anonymous component declarations (e.g. https://github.com/WebAssembly/component-model/issues/598) would interact with it. We'd have this anonymous component {} instance - but that is then wrapped by a named world "root"?

view this post on Zulip Yosh Wuyts (Apr 28 2026 at 11:53):

I guess I'm also extra confused because in wac compositions don't ever reference the world "root", even though that is what we call our entry point. For example:

// no reference to "root" here
let my-instance = new example:my-component { ... };

view this post on Zulip Yosh Wuyts (Apr 28 2026 at 12:02):

Oh I just found: "Specifying a root package" - though this doesn't talk about the world "root".

view this post on Zulip Yosh Wuyts (Apr 28 2026 at 12:04):

TLDR on what my question here is: Is the world "root" an implementation detail of components that we can inline, or is it a genuine addressable world which we should preserve in docs?

view this post on Zulip Ralph (Apr 28 2026 at 12:06):

it is probably time to make a clear statement on "root"

view this post on Zulip Yosh Wuyts (Apr 28 2026 at 12:25):

Maybe answering my own question here: say I define the following WIT:

package yoshuawuyts:wordmark;

world wordmark {
    /// Convert a markdown document to a Word (.docx) document.
    export to-word: func(markdown: string) -> result<list<u8>, string>;
}

If I compile this then the resulting WIT on the component looks like this:

package root:component;

world root {
  export to-word: func(markdown: string) -> result<list<u8>, string>;
}

All references to yoshuawuyts:wordmark are gone, and all we have left is the world root. This to me seems to point at the name "root" being an implementation detail, and not actually worth naming in any visualizations.

view this post on Zulip Ralph (Apr 28 2026 at 12:36):

for me, it's "magical appearance" would make any engineer ask questions to which there must be answers published so it can be counted on, one way or the other. Everything that "dangles" will attract attention and that distracts from usage. :-)

view this post on Zulip Yosh Wuyts (Apr 28 2026 at 12:46):

hah yeah

view this post on Zulip Alex Crichton (Apr 28 2026 at 14:13):

Nothing special about "root", just a name that had to be invented since something needed to be put there

view this post on Zulip Joel Dice (Apr 28 2026 at 14:19):

It's just a wit-bindgen/wit-component thing, right? I.e. not part of the component model or any official specification?

view this post on Zulip Alex Crichton (Apr 28 2026 at 14:20):

Correct

view this post on Zulip Alex Crichton (Apr 28 2026 at 14:20):

kinda like all the naming wit-component requires when creating a component, it's all invented and made-up and none of it's official

view this post on Zulip Joel Dice (Apr 28 2026 at 14:21):

For those following along at home, this is a step towards making something official.

view this post on Zulip Yosh Wuyts (Apr 28 2026 at 16:03):

Talked this over sync with Alex today; inlining the world as part of the component is indeed the right way to go about it.

view this post on Zulip Yosh Wuyts (Apr 28 2026 at 16:04):

Yosh Wuyts said:

But if that's the case, then I'm confused how anonymous component declarations (e.g. https://github.com/WebAssembly/component-model/issues/598) would interact with it. We'd have this anonymous component {} instance - but that is then wrapped by a named world "root"?

Also it turns out this ^ will be really helpful if we can land it

view this post on Zulip Yosh Wuyts (Apr 28 2026 at 16:08):

Screenshot 2026-04-28 at 18.07.29.png
just for context: this is how I have it rendering now ^^


Last updated: May 03 2026 at 22:13 UTC