Skip to content

Add Wit.md section for resource items#206

Merged
lukewagner merged 2 commits intomainfrom
add-resources-to-wit
Jun 19, 2023
Merged

Add Wit.md section for resource items#206
lukewagner merged 2 commits intomainfrom
add-resources-to-wit

Conversation

@lukewagner
Copy link
Member

This PR rescues a hunk from #203 that adds a Wit.md section for resource definitions (including methods).

takes and returns a handle to a `blob`:
```wit
resource blob
transform: func(blob) -> blob
Copy link
Member

Choose a reason for hiding this comment

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

Would it make sense to also introduce a function that uses a borrow here, just to introduce the concept, for someone reading this top-down, before launching into more complex examples with borrows below? This would also be a good place to mention the relationship between owned handles and resource lifetimes.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, good point!

Copy link
Member Author

Choose a reason for hiding this comment

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

Added, PTAL

Copy link
Collaborator

@alexcrichton alexcrichton left a comment

Choose a reason for hiding this comment

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

👍 Makes me realize we need to adjust the parsing in wit-parser a bit, which is good though because I think the syntax here is good

Copy link
Member

@sunfishcode sunfishcode left a comment

Choose a reason for hiding this comment

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

Looks good!

@lukewagner lukewagner merged commit 08c60a4 into main Jun 19, 2023
@lukewagner lukewagner deleted the add-resources-to-wit branch June 19, 2023 19:40
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.

3 participants