Repository navigation
Add extension claims - #11579
Add extension claims#11579
Conversation
Merging this PR will not alter performance2 warnings
Comparing Footnotes
|
|
what is wrong with derives? |
|
@joseph-isaacs this is technically a derive but unlike Rust where we derive a specific function, here we need to claim a property on the type (like a trait) such that functions are well defined. So it's slightly different (and maybe the terminology here is overloaded). |
Signed-off-by: Connor Tsui <connor.tsui20@gmail.com>
2fbac1e to
b27aa23
Compare
State the float semantics that claims inherit and what a false claim does, and tell storage-parametric types to derive their claims from storage. List Ord before Eq so a failed check names the declared claim, and test that Claim::ALL covers every variant. Signed-off-by: Connor Tsui <connor.tsui20@gmail.com>
The notes still described a `&'static [Claim]` list with `Claim::implies`, which the PR replaced with the opaque `Claims` value. Signed-off-by: Connor Tsui <connor.tsui20@gmail.com>
robert3005
left a comment
There was a problem hiding this comment.
not sure about the name, rust and haskell both call this derives
Functions use the storage of any extension type today, so comparing two
Jsonvalues compares their strings. A type needs a way to promise that its storage answers equality or order correctly before a function can trust it. This PR adds only the declaration, and #11600 makes each function check it.ExtVTable::claimsreturns an opaqueClaimsvalue. A&'static [Claim]slice was the alternative, but the slice could disagree withDType::holdsaboutEq, it had several values for the same promise ([Ord]and[Eq, Ord]), and it could only name properties. Private fields leave room for a custom order key later.AI assisted with this change.