Skip to content

Conversation

vados-cosmonic
Copy link
Collaborator

This PR updates the host to use the existing adder interface, and actually re-use the existing WIT file so it should be harder to diverge in the future.

Resolves #24

@kate-goldenring
Copy link
Collaborator

kate-goldenring commented Jan 20, 2025

@vados-cosmonic many of the language guides reference this example world (add.wit). This PR will need to update all those guides to use the adder world, as well, before we can delete that file and update the example host

@vados-cosmonic
Copy link
Collaborator Author

vados-cosmonic commented Jan 21, 2025

Hey @kate-goldenring thanks for the catch -- I was under the impression that most guides were using the adder world, not the other way around, all of them use the host's WIT.

At this point, guides like the C# guide actually explicitly use/take into account the lack of an interface (and later show you how to build an adder via interfaces) -- it looks like add.wit should stay.

With the goal of centralizing the WIT to a single place and away from host code, what do you think about examples/tutorial/wit/simple-add/world.wit or examples/tutorial/wit/add-fn/world.wit (as opposed to examples/tutorial/wit/adder/world.wit for the adder world that has an interface) for the name of the resurrected add.wit ?

@kate-goldenring
Copy link
Collaborator

@vados-cosmonic i'd rather move everything to the adder world (which has an interface) as updating the language guides to use a world with an interface is the explicit goal of the issue this PR aims to resolve: #24

The c guide takes into account the lack of interface because our example has no interface not because it should -- I'd rather it does not discuss using worlds that don't use interfaces as it is a best practice to use interfaces IMO.

@vados-cosmonic
Copy link
Collaborator Author

Alright, that sounds good -- we'll knock out #24 as well at the same time in this PR!

The c guide takes into account the lack of interface because our example has no interface not because it should -- I'd rather it does not discuss using worlds that don't use interfaces as it is a best practice to use interfaces IMO.

Absolutely agree here -- while the simple function case might be good for simplicity (less new keywords mentioned, etc), the best practice is definitely using interfaces.

@kate-goldenring
Copy link
Collaborator

@vados-cosmonic just a check on this, i know it is a lot of updates. I can also help take some of this on as well. Would be great to get rid of the interface-less add.wit interface and only use the adder world

@vados-cosmonic
Copy link
Collaborator Author

Hey thanks for the ping -- I got busy and forgot about this -- need to get back to it! I'll find time to wrap this up by next week!

@vados-cosmonic vados-cosmonic force-pushed the fix=use-adder-interface-for-host branch 2 times, most recently from a3af44b to 19bc006 Compare March 18, 2025 10:29
Copy link
Collaborator

@kate-goldenring kate-goldenring left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks @vados-cosmonic. I left a few nits that could be addressed in this PR or a subsequent one

@vados-cosmonic vados-cosmonic force-pushed the fix=use-adder-interface-for-host branch 7 times, most recently from e5af4f9 to 6322c17 Compare March 21, 2025 14:04
@vados-cosmonic
Copy link
Collaborator Author

Hey @kate-goldenring finally this is done and I think mergable! It should merge after James's awesome work here: #221 (I already merged his changes in actually but just don't want to "steal" his hard work!)

Definitely happy to follow with follow ups as well if you find anything I missed -- I went through all the guides for all the languages and they all worked just fine. There may be some step numbering issues (I introduced step numbering where there wasn't for many of the guides).

@kate-goldenring
Copy link
Collaborator

@vados-cosmonic sounds good! Can you rebase and we should be set to merge?

Signed-off-by: Victor Adossi <vadossi@cosmonic.com>
Signed-off-by: Victor Adossi <vadossi@cosmonic.com>
Signed-off-by: Victor Adossi <vadossi@cosmonic.com>
Signed-off-by: Victor Adossi <vadossi@cosmonic.com>
Signed-off-by: Victor Adossi <vadossi@cosmonic.com>
Signed-off-by: Victor Adossi <vadossi@cosmonic.com>
Signed-off-by: Victor Adossi <vadossi@cosmonic.com>
Signed-off-by: Victor Adossi <vadossi@cosmonic.com>
Signed-off-by: Victor Adossi <vadossi@cosmonic.com>
Signed-off-by: Victor Adossi <vadossi@cosmonic.com>
Signed-off-by: Victor Adossi <vadossi@cosmonic.com>
Signed-off-by: Victor Adossi <vadossi@cosmonic.com>
Signed-off-by: Victor Adossi <vadossi@cosmonic.com>
Signed-off-by: Victor Adossi <vadossi@cosmonic.com>
@vados-cosmonic vados-cosmonic force-pushed the fix=use-adder-interface-for-host branch from 7d9657a to 12b0eeb Compare March 22, 2025 02:00
Signed-off-by: Victor Adossi <vadossi@cosmonic.com>
@vados-cosmonic
Copy link
Collaborator Author

Hey @kate-goldenring apologies for the delay here -- should be good to go!

@kate-goldenring kate-goldenring merged commit 7fd75d1 into bytecodealliance:main Mar 24, 2025
@vados-cosmonic vados-cosmonic deleted the fix=use-adder-interface-for-host branch March 24, 2025 15:41
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.

Update language guide add example to use a world with an interface

2 participants