More refactoring/reshuffling of component async intrinsics#2064
Merged
alexcrichton merged 5 commits intobytecodealliance:mainfrom Feb 24, 2025
Merged
Conversation
Simplify some callers/accessors by plumbing around this whole structure instead of having some intrinsics just have portions where others have more.
Refactor some internals of async stream/future read/write and `task.return` to avoid passing `Function` and instead just pass then name around.
Don't so heavily nest the variables here indentation-wise.
This commit refactors the integration of async intrinsics into wit-component to support future changes to the `task.return` intrinsic. The refactoring here moves detection of intrinsics to all be in the same path rather than having one path which handles async intrinsics, another patch which handles resource intrinsics, and another path which handles `task.return` intrinsics. By handling everything in one location it's easier to ensure that everything is handled uniformly and various bits and pieces of contextual information are also easily available. This refactoring additionally updates the names recognized for async intrinsics. Previously for example async imports might use `[import-payload]` which is now no longer required. Additionally async imports might use `[export-payload]` too and that's changed to be `[export]` to match how other exports are handled as well.
dicej
approved these changes
Feb 24, 2025
Co-authored-by: Joel Dice <joel.dice@fermyon.com>
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
As I continue to grapple with
wit-component,task.return, and the addition of canonical options I've continued to find more locations which I'd like to refactor/improve related to how async intrinsics are handled. This is a series of a few minor refactorings leading up to a more major refactoring which changes the names of imported intrinsics. The end goal is to make all intrinsics "look more alike" to one another in terms of how they're detected/processed and avoid having two distinct paths for async and not-async.The final commit here is the meat of this PR which shuffles around where intrinsics are validated and how they're processed and additionally renames the imports that generate intrinsics. I've attempted to otherwise split this by commit in terms of logical units and additionally document each commit itself.