-
Notifications
You must be signed in to change notification settings - Fork 45
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
feat(composition): Adding an example that shows composition of isolated components #135
base: main
Are you sure you want to change the base?
Conversation
Thanks for this @ritesh089! I'm afraid I'm not quite getting how this connects up to the book at the moment. For example, is the reason for it to illustrate something that needs to be added to the book? Or is it intended as a new example to illustrate existing book content? Once we understand that we can figure out the best way to move forward with it. Thanks! |
The components are usually written in separate repositories and the great thing about the component model is reuse. The example currently shown in the docs uses a single wit and doesn't really show how to use the interfaces defined in separate packages. |
Thanks @ritesh089 - I see what you mean about showing how this works across multiple packages and repos. What I'd suggest is making those documentation changes as part of this PR, so that the example is explained in context rather than merely existing unlinked in the examples directory. We can also maybe have a look at how we can structure the examples to ease maintenance of all this (a particular concern as we are likely to move to @kate-goldenring Does this sound appropriate to you, or do you feel it's outside the remit of the book (or would work better as a separate piece of content that the book can link to)? |
I've heard other feedback that one WIT is an oversimplification. Updating the example to have a separate WIT for each package (essentially just separating out |
Thanks @kate-goldenring , |
Thanks @ritesh089. I'd keep the changes minimal to start, so retaining just the add component with the separated WIT and updating the documentation. Then in a separate PR we can consider adding the sub component. |
I found the original version this If it doesn't fit here, maybe there is another place in the bytecodealliance ecosystem for nice starter examples. |
@FrankReh , I didnt understand this part : I think i will change this PR to draft for reference and open a new PR just updating the add component and doc for now . |
I think the example used a |
@FrankReh just to clarify, the current example in |
@kate-goldenring You are right. I probably wouldn't have added my two cents here if I had not read through the published book for the component-model as one of the first things I read about a month ago. Looking at the tutorial back then, everything was so new I couldn't grok everything that was being accomplished. After a month of learning, coming at the proposed Yes, splitting the WIT into separate pieces will do well in showing just how modular the building blocks are, and how the WIT files can be used to build on each other. I just looked at the cargo_component_bindings::generate!(); while the "composition/calculator/src/lib.rs" uses bindings::export!(Component with_types_in bindings); Believe me, I know writing good documentation is hard. Kudos to the team doing this. The step mentioned above to split the WIT files sounds great. Also I appreciate how the Wasm Component tools work and can be used is a moving target. WIT is changing. Composing is changing. Repos are being moved around. And does one document how WASI Preview 2 was at the time of its announcement or where it is now. I still think the project could benefit from a repo that held little examples of how people solved different things. But I can't say I know how that should be organized or where one draws the line between being approachable for a new person versus someone who has been around for a few months versus someone who has been around a few years. So thanks again. Sorry for being so long winded on this. |
This PR contains an example where component can be written and built separately in different languages and then composed together.