Stream: wit-bindgen

Topic: status of resource


view this post on Zulip Nathaniel McCallum (Nov 10 2022 at 14:22):

The wit documentation defines the resourceitem but this appears to be removed from wit-bindgen. What is the status of this?

Repository for design and specification of the Component Model - component-model/WIT.md at main · WebAssembly/component-model

view this post on Zulip Dan Gohman (Nov 14 2022 at 18:38):

The status is that resources are a very important feature but are not yet described by the component-model spec. wit-bindgen had a prototype implementation, but it's been removed in order to simplify other component implementation work, and because the semantics of handles are expected to be a little different from what was prototyped.

view this post on Zulip Dan Gohman (Nov 14 2022 at 18:39):

Luke and others are actively working on the new resource+handle design in the component model, as it's a high priority for a lot of use cases.

view this post on Zulip Nathaniel McCallum (Nov 16 2022 at 19:35):

@Dan Gohman Is the expectation to install wit-bindgen from git?

view this post on Zulip Lann Martin (Nov 16 2022 at 19:46):

Yes

view this post on Zulip Lann Martin (Nov 16 2022 at 19:47):

Intentionally (I think) not on crates.io because of how unstable it is known to be

view this post on Zulip Nathaniel McCallum (Nov 22 2022 at 18:20):

@Alex Crichton I see that world file syntax has landed. Can you give me a pointer to the documentation for that syntax?

view this post on Zulip Nathaniel McCallum (Nov 22 2022 at 18:23):

I found this: https://github.com/WebAssembly/component-model/blob/8a5669d4b6e534f3cd70a4b90f482ab94e4e891d/design/mvp/WIT.md#item-world

Repository for design and specification of the Component Model - component-model/WIT.md at 8a5669d4b6e534f3cd70a4b90f482ab94e4e891d · WebAssembly/component-model

view this post on Zulip Nathaniel McCallum (Nov 22 2022 at 18:25):

But that document still has resources, etc in the syntax.

view this post on Zulip Alex Crichton (Nov 22 2022 at 18:29):

I'd recommend reading tests and such for now, it's not documented yet

view this post on Zulip Nathaniel McCallum (Nov 22 2022 at 18:36):

Has the use keyword been removed?

view this post on Zulip Peter Huene (Nov 22 2022 at 18:50):

yes, as part of the implementation of parsing worlds; much like resource, it was removed in anticipation of doing it "for real" with a proper spec

view this post on Zulip Nathaniel McCallum (Nov 22 2022 at 18:59):

Is it possible to use a type defined in one interface in another interface?

view this post on Zulip Alex Crichton (Nov 22 2022 at 19:01):

With use being temporarily removed, no, you'll need to copy/paste

view this post on Zulip Alex Crichton (Nov 22 2022 at 19:01):

It's expected to not take too long before re-adding use

view this post on Zulip Nathaniel McCallum (Nov 22 2022 at 19:02):

Does use also export the values specified by use?

view this post on Zulip Alex Crichton (Nov 22 2022 at 19:26):

Sorry I don't know how best to answer that since use isn't currently implemented

view this post on Zulip Nathaniel McCallum (Nov 22 2022 at 19:52):

@Alex Crichton I'm implementing it now. So I'm asking what the preferred implementation should be. Sorry for lack of clarity.

view this post on Zulip Alex Crichton (Nov 22 2022 at 19:53):

Have you talked with Luke or Brian or others? There's a number of design questions about use which are unresolved which were why the initial implementation was removed and deferred temporarily.

view this post on Zulip Nathaniel McCallum (Nov 22 2022 at 19:53):

Nope. But I'm happy to chat.

view this post on Zulip Nathaniel McCallum (Nov 22 2022 at 19:54):

@Alex Crichton Which Brian?

view this post on Zulip Alex Crichton (Nov 22 2022 at 19:55):

this one -- https://github.com/fibonacci1729/

fibonacci1729 has 78 repositories available. Follow their code on GitHub.

view this post on Zulip Brian (Nov 22 2022 at 19:55):

:wave: Hey Nathaniel, happy to chat

view this post on Zulip Alex Crichton (Nov 22 2022 at 19:55):

I think we'll try to meet next week once everyone's back to talk about things, ahead of time I do not personally have a complete picture of what use should look like

view this post on Zulip Nathaniel McCallum (Nov 22 2022 at 19:55):

@Luke Wagner ?

view this post on Zulip Nathaniel McCallum (Nov 22 2022 at 19:56):

@Luke Wagner Are you available?

view this post on Zulip Nathaniel McCallum (Nov 22 2022 at 19:58):

@Brian Available now?

view this post on Zulip Brian (Nov 22 2022 at 19:58):

I'll be available at the top of the hour

view this post on Zulip Nathaniel McCallum (Nov 22 2022 at 19:59):

@Alex Crichton @Luke Wagner @Brian https://meet.google.com/kjj-rqog-kni

Real-time meetings by Google. Using your browser, share your video, desktop, and presentations with teammates and customers.

view this post on Zulip Alex Crichton (Nov 22 2022 at 19:59):

sorry I'm not personally available to meet about this today, but y'all are of course welcome to

view this post on Zulip Nathaniel McCallum (Nov 22 2022 at 20:00):

No worries. I think I have enough to go on given my reading of the AST.

view this post on Zulip Luke Wagner (Nov 22 2022 at 20:17):

I'm happy to jump in now or later.

view this post on Zulip Brian (Nov 22 2022 at 20:36):

Just chatted with Nathaniel and he is working to re-add use to enable sharing types between interfaces defined in the same *.wit file, improving the usability of *.wit today. This makes sense to me since most of the design questions around use arise from wits that are spread across multiple files.

view this post on Zulip Nathaniel McCallum (Nov 22 2022 at 21:28):

@Brian Having now torn a bunch of this apart, I think defaulting to "private" imports doesn't really make sense. You basically only import types for the purposes of re-exporting them OR using them as params/results for functions. In the later case, the types must be public otherwise the functions aren't callable.

view this post on Zulip Brian (Nov 22 2022 at 21:47):

@Nathaniel McCallum So instead of what we discussed (i.e. re-exporting via a type alias),
are you suggesting something like:

interface a {
    type x = string
}

interface b {
    use { x } from a
}

interface c {
    use { x } from b
}

view this post on Zulip Nathaniel McCallum (Nov 22 2022 at 22:14):

@Brian Yes, precisely.

view this post on Zulip Philpax (Jan 11 2023 at 12:06):

Hi! Apologies for resurrecting this thread, but I was wondering if there had been any progress on same-file type sharing between interfaces. I'd like to share types between my imports and exports, but I'm guessing this isn't supported yet: error: expected type or func, found keyword use` for a use * from common in the interface`.

Will this be implemented soon, and if not, what's the best way to handle type-sharing? (i.e. before updating, I had duplicate types that I had to manually merge together in the host code. Is that still necessary?)

Cheers!

view this post on Zulip Dan Gohman (Jan 11 2023 at 12:09):

Progress is being made! https://github.com/bytecodealliance/wasm-tools/pull/867

I'm opening this up now to share some early work on this. This is unfortunately going to again be a very large PR due to the sheer amount of infrastructure required to pull in all the WIT updates, ...

view this post on Zulip Philpax (Jan 11 2023 at 13:20):

Oh wow, that's awesome, thank you! Looks promising; I'll see if I can postpone this update until that lands.


Last updated: Dec 23 2024 at 13:07 UTC