Skip to content

Convert component resource to a record - #17

Open
scothis wants to merge 3 commits into
componentized:mainfrom
scothis:resourceless
Open

Convert component resource to a record#17
scothis wants to merge 3 commits into
componentized:mainfrom
scothis:resourceless

Conversation

@scothis

@scothis scothis commented Sep 1, 2026

Copy link
Copy Markdown
Member

Resources are not composable from unique sources within the same component. For example, component resources in the wac-loader could only be consumed as resources from the wac-loader. This makes it impossible to actually bootstrap and compose a component.

Switching to a record avoids these issues.

A significant downside to using a record is that the bytes for the component must be initialized when the record is created. This makes lazy loading components on demand impossible. Likewise, if we wanted to change the list to stream, it could only be read once, and inherently less useful.

@scothis
scothis requested a review from markfisher September 1, 2026 11:37
Resources are not composable from unique sources within the same
component. For example, component resources in the wac-loader could only
be consumed as resources from the wac-loader. This makes it impossible
to actually bootstrap and compose a component.

Switching to a record avoids these issues.

A significant downside to using a record is that the bytes for the
component must be initialized when the record is created. This makes
lazy loading components on demand impossible. Likewise, if we wanted to
change the list<u8> to stream<u8>, it could only be read once, and
inherently less useful.

Signed-off-by: Scott Andrews <scott@andrews.me>
wit map's are now part of the component model spec. Unfortunately, the
key cannot be a complex type like a record, or even a type alias for a
supported type. So we're denormalizing the id types from records to
strings. Each id take the form of `type:{value}` so that the keys in
each map are unique.

Signed-off-by: Scott Andrews <scott@andrews.me>
Loaders may extract and populate the wit, or leave it empty until a
consumer needs the wit content.

Signed-off-by: Scott Andrews <scott@andrews.me>
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

Successfully merging this pull request may close these issues.

1 participant