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
Baked data: use VarULE to store data when specified #6133
base: main
Are you sure you want to change the base?
Baked data: use VarULE to store data when specified #6133
Changes from 15 commits
522e1ab
309d12d
8d45d49
5c34469
a814e3b
781fe51
1eee363
9b18826
5bd8b18
255122a
1eb0897
c1e86b1
6eea0dd
fc564ea
e73da50
81035bb
4cc5166
2e09206
035abb3
8c12687
d6dcd09
8ffb284
889a44f
c3e539f
8eb18c5
dd381a4
a343f01
8511175
9f42022
32b18c6
cd71e4a
de923c3
ef365c5
b51cc77
6eccf2e
bf91bd4
d5c1922
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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.
observation: this optimisation should also be applied to the binary search data store, or we should delete it.
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.
Is it ok if I make an issue to fix the binary search baked backend instead of deleting or updating it in this PR?
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.
yes
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.
can this not be more typed?
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.
issue: please introduce a specific trait for this instead of abusing
From
.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 pushed a possible design. I don't think I like it.
As discussed in DM, we need 2 different associated types with this design: one that is a reference and one that is a VarULE. The one that is a reference, which I named
EncodeAsVarULE
,I disagree that my use of
From
is an "abuse" of the trait, but I acknowledge the point of view thatFrom
looks like it might do some sort of transformation on the string. I believe thatZeroFrom
does not carry similar baggage. I would prefer to revert to something closer to what I had before, with a single associated type, but usingZeroFrom
.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.
^ would like to highlight this open question
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.
Given the proposed conclusion on #6133 (comment), I want to double-down on my position that we should use two traits, one for datagen and one for runtime. I would like the datagen trait to be the
MaybeExportAsVarULE
and the runtime trait to beZeroFrom
. I am willing to use custom traits in both situations.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.
Technically this could be 3 traits, since there are 3 unique, disjoint things we need, in different situations:
maybe_as_varule -> Option<(impl VarULE or impl EncodeAsVarULE)>
pub type VarULE
from_varule -> Self
A potential design for this would be 3 traits: (2) would be a base trait and (1) and (3) would extend it.
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.
ZeroFrom is supposed to be the reverse operation of EncodeAsVar, and we don't actually need a reverse of MaybeEncodeAsVar
Our trait universe here is already rather confusing: if we can make it work with ZeroFrom and EncodeAsVar, we should. I think what you had previously with the single trait was better, except it should have used ZeroFrom. I'm not a fan of proliferating more traits, I'm still struggling to understand how these all fit together.
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.
Do you have a suggestion on this? What should non-varule data structs do in their EncodeAsVarULE impls?
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 comment is not relevant since we don't have specialization, but ideally what I'd like to do here is
But since I can't do that, then I need to implement
MaybeEncodeAsVarULE
manually, which I think has fed the perception throughout this review process that it is an "opt out".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.
Oh, I see the problem. We could have a blanket Encode impl for all T on the NeverVar ZST but if that doesn't work, then a separate trait is fine.
No, I understood that part: the "opt out" comment was specifically about the macro setup, as I have said before. That's already been clarified now. It was misleading to see non-VarULE optimized data structs in list and properties have to invoke an opt-out macro, but what was actually happening was subtler.
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.
Discussion:
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.
nit: update comment to "TODO Allow the automatic impl of MaybeAsVarULE to be configured" since it's not obvious from the macro anymore