Closed
Conversation
28c0bc9 to
c229183
Compare
f3928b7 to
9a5a247
Compare
Mossaka
reviewed
Apr 18, 2025
Member
Mossaka
left a comment
There was a problem hiding this comment.
I like this change personally!
| // ResultTupleIncomingDatagramStreamOutgoingDatagramStreamErrorCode represents the imported result "#". | ||
| // | ||
| // result<tuple<incoming-datagram-stream, outgoing-datagram-stream>, error-code> | ||
| type ResultTupleIncomingDatagramStreamOutgoingDatagramStreamErrorCode cm.Result[TupleIncomingDatagramStreamOutgoingDatagramStreamShape, cm.Tuple[IncomingDatagramStream, OutgoingDatagramStream], ErrorCode] |
Member
There was a problem hiding this comment.
oh wow this type name is brutally long.
Collaborator
Author
There was a problem hiding this comment.
Yeah, this isn’t great.
Comment on lines
+1
to
+22
| // Code generated by wit-bindgen-go. DO NOT EDIT. | ||
|
|
||
| package streams | ||
|
|
||
| import ( | ||
| "go.bytecodealliance.org/cm" | ||
| ) | ||
|
|
||
| // ResultListU8StreamError represents the imported result "#". | ||
| // | ||
| // result<list<u8>, stream-error> | ||
| type ResultListU8StreamError cm.Result[cm.List[uint8], cm.List[uint8], StreamError] | ||
|
|
||
| // ResultU64StreamError represents the imported result "#". | ||
| // | ||
| // result<u64, stream-error> | ||
| type ResultU64StreamError cm.Result[uint64, uint64, StreamError] | ||
|
|
||
| // ResultStreamError represents the imported result "#". | ||
| // | ||
| // result<_, stream-error> | ||
| type ResultStreamError cm.Result[StreamError, struct{}, StreamError] |
Member
There was a problem hiding this comment.
nice this will reduce the burden of spelling out the shape of the Result type everytime you use it.
Collaborator
Author
There was a problem hiding this comment.
I'm not sure it's better!
Collaborator
Author
|
Not going in this direction. |
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.
This is a rudimentary POC to demonstrate an alternative approach to #331. It generates named Go types for any
resultdirectly used in a function.It trades Go generic complexity for additional named type surface area. I’m not sure which is better.
Inspired by a suggestion from @Mossaka.