Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow exporting types directly worlds without interface #426

Open
jcbhmr opened this issue Dec 5, 2024 · 1 comment
Open

Allow exporting types directly worlds without interface #426

jcbhmr opened this issue Dec 5, 2024 · 1 comment

Comments

@jcbhmr
Copy link

jcbhmr commented Dec 5, 2024

Components are also able to directly export types, so it is just a temporary WIT limitation that you're not able to define and export the math-class enum directly in the world. We should probably fix that to avoid this question.

In the meantime, you can also write:

world w {
  export types: interface {
    enum math-class { ... }
  }
}

Originally posted by @lukewagner in #295 (comment)

The ideal is to somehow have the math-class enum on the root world instead of nested inside a redundant interface name. Unsure if you still want to pursue this.

@lukewagner
Copy link
Member

I think this is still a good idea. The general goal here is to achieve full co-expressivity between WIT and component-model types and indeed today in component-model WAT, you can define a type:

(type $w (component
  (type $math-class (enum ...))
  (export "math-class" (type (eq $math-class)))
))

so it makes sense for us to provide a WIT "rendering" of this raw WAT type. My best guess is that it would look like:

world w {
  export math-class: enum { ... }
}

symmetric to how named and unnamed interfaces work. It's mostly just a matter of prioritization and getting someone (with enough WIT tooling experience) to work on an implementation to co-develop with the spec (since the devil is in the details here). I do think we'll want to prioritize co-expressivity before declaring a complete 1.0 though.

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

No branches or pull requests

2 participants