Skip to content

Conversation

andreakarasho
Copy link
Contributor

By design the record wit type is just a set of fields (https://component-model.bytecodealliance.org/design/wit.html#records) This PR aims to reduce the GC work changing from a class to a readonly struct.

By design the `record` wit type is just a set of fields (https://component-model.bytecodealliance.org/design/wit.html#records)
This PR aims to reduce the GC work changing from a `class` to a `readonly struct`.
@GerardSmit
Copy link
Contributor

Additional: the design document states the following

Records are similar to a struct in many languages.
https://github.com/WebAssembly/component-model/blob/2c17516179f99accdafb01d8e4affcc0f58184cc/design/mvp/WIT.md?plain=1#L1514-L1516

It's also not possible to recursively reference a record. wit-bindgen already checks for this. I tried to reference point in point:

   0: failed to parse package: wit
   1: type `point` depends on itself

https://github.com/bytecodealliance/wasm-tools/blob/544ac54d0d9d43bcfed2597af4293729dfb89854/crates/wit-parser/src/ast/toposort.rs#L169-L171

@yowl
Copy link
Collaborator

yowl commented Sep 3, 2025

Thanks, I need to fix the CI first.

@jsturtevant jsturtevant added this pull request to the merge queue Sep 23, 2025
Merged via the queue into bytecodealliance:main with commit 545dc8d Sep 23, 2025
20 checks passed
@pavelsavara pavelsavara added the gen-c# Related to the C# code generator label Sep 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
gen-c# Related to the C# code generator
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants