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.
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve type flexibility when building
ScVal
s from native types #638Improve type flexibility when building
ScVal
s from native types #638Changes from 8 commits
245efd0
49de1d6
3e59554
24d95b8
92e264a
1f24070
19422da
bd7836a
06b9ade
c0f8d8c
2b1b010
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this may get to be an uber-method to maintain all type permutations for native types in one method. As of now, should docs explicitly show a matrix of valid native type to opt.types? or callers need to look at code.
just for consideration later, ways to cordon options directly to their native types, like a TypeConverter class with
toScVal/fromScVal
or functional like passing converter function instead likenativeToScVal(val, converterFn)
. I think recall seeing in past reviews that baking this type of conversions into generated ScVal from xdr was not reasonable.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree that there's a risk here of permutation blow-up, BUT I'm hoping that this can stay relatively lightweight. The matrix is sparse, so to speak, in that many types have one or two possibilities at most. So hopefully it doesn't get ugly. (In fact, you could even argue that some of the permutations are the fault of design mistakes on the XDR level, like
ScVal.scvString
s taking aBuffer
, but I digress...)With the discussion on custom, user-defined types in #637, you very well may be right that this can end up exploding into an uber method... so let's cross that bridge if we get to it? I don't want to over-invest a lot of architectural thought into this until we get community feedback on whether or not this is even a useful abstraction to provide in the first place. I think of this as a "minimum high-level implementation" to try to help downstream folks not deal with XDR so much, more-so than a perfect v0 solution.