Skip to content

Conversation

aaronjeline
Copy link

Description of changes

Reduces the precision of partial evaluation when reducing expressions that are lazily evaluated (if and or subexpressions). The primary motivation for this is removing the error extension function, which is impossible to type.

Increases in precision without re-introducing error could come later.

Issue #, if available

N/A

Checklist for requesting a review

The change in this PR is (choose one, and delete the other options):

  • A change (breaking or otherwise) that only impacts unreleased or experimental code.

I confirm that this PR (choose one, and delete the other options):

  • Updates the "Unreleased" section of the CHANGELOG with a description of my change (required for major/minor version bumps).

I confirm that cedar-spec (choose one, and delete the other options):

  • Does not require updates because my change does not impact the Cedar formal model or DRT infrastructure.

@aaronjeline aaronjeline marked this pull request as ready for review May 15, 2024 15:11
@aaronjeline aaronjeline requested review from cdisselkoen and khieta May 15, 2024 15:11
Copy link
Contributor

@khieta khieta left a comment

Choose a reason for hiding this comment

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

Looks fine to me. A little sad to see the precision loss in the updated test cases -- maybe open an issue to consider precision optimizations in the future?

/// Create a ternary (if-then-else) `Expr`.
/// Takes `Arc`s instead of owned `Expr`s
/// `test_expr` must evaluate to a Bool type
pub fn ite_arc(test_expr: Arc<Expr>, then_expr: Arc<Expr>, else_expr: Arc<Expr>) -> Self {
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: can we make it pub(crate)?

Copy link
Author

Choose a reason for hiding this comment

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

Rest of the functions are not pub(crate), why this one?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think the signature of this function is not idiomatic as public functions. I was thinking another function as well but just commented on this one.

Copy link
Contributor

Choose a reason for hiding this comment

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

This is just pub in Core, right? not re-exported in cedar-policy?

@aaronjeline aaronjeline force-pushed the aaronjeline/no-more-error branch from d3917c9 to b56bbad Compare May 15, 2024 17:06
/// Create a ternary (if-then-else) `Expr`.
/// Takes `Arc`s instead of owned `Expr`s
/// `test_expr` must evaluate to a Bool type
pub fn ite_arc(test_expr: Arc<Expr>, then_expr: Arc<Expr>, else_expr: Arc<Expr>) -> Self {
Copy link
Contributor

Choose a reason for hiding this comment

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

This is just pub in Core, right? not re-exported in cedar-policy?

Aaron Eline and others added 2 commits May 17, 2024 09:11
Signed-off-by: Aaron Eline <[email protected]>

Co-authored-by: Craig Disselkoen <[email protected]>
Signed-off-by: Aaron Eline <[email protected]>

Co-authored-by: Craig Disselkoen <[email protected]>
@aaronjeline
Copy link
Author

Issue for re-increasing precision: #880

@aaronjeline aaronjeline merged commit 7cb7e32 into main May 17, 2024
@aaronjeline aaronjeline deleted the aaronjeline/no-more-error branch May 17, 2024 13:32
khieta pushed a commit that referenced this pull request Aug 9, 2024
Signed-off-by: Aaron Eline <[email protected]>
Co-authored-by: Craig Disselkoen <[email protected]>
khieta added a commit that referenced this pull request Aug 9, 2024
Signed-off-by: Aaron Eline <[email protected]>
Co-authored-by: Aaron Eline <[email protected]>
Co-authored-by: Craig Disselkoen <[email protected]>
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.

4 participants