This repository was archived by the owner on Oct 3, 2025. It is now read-only.
Check returns in untyped host functions#27
Merged
explodingcamera merged 3 commits intoexplodingcamera:nextfrom Jan 6, 2025
Merged
Check returns in untyped host functions#27explodingcamera merged 3 commits intoexplodingcamera:nextfrom
explodingcamera merged 3 commits intoexplodingcamera:nextfrom
Conversation
- Move test to crate directory - Remove types argument from HostFuncs - Update CHANGELOG.md Signed-off-by: Henry Gressmann <mail@henrygressmann.de>
explodingcamera
approved these changes
Jan 6, 2025
Owner
explodingcamera
left a comment
There was a problem hiding this comment.
Thanks for the PR! I've removed the return types arg for now, if there's a use-case to have it I'd probably rather add it to the ctx. I've moved the tests to the tinywasm crate for now, but I might reorganize them a bit later.
Contributor
Author
|
I see. I did that, because it didn't make host function carry its expected types, which are already known at the time and place of calling - but admittedly it is more awkward to pass them every time |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Host function created with
Extern::funccould return wrong types and executor wouldn't notice. So I took a crack at fixing it. I'm a rust beginner though, so review carefullyI'm not sure about tests location - so far I've put them into "test" folder in the repo root which (if I understood "integration tests" chapter) is a standard way to test public api. Test suite doesn't have "wat" module and appears to me to be directed more at wasm side, rather than host side api.
I also added checks to that test file to ensure that host function don't link if types mismatch, because
i couldi had utility functions for trying combinations anyway, and they are thematically close (as "imported host function signature")