Skip to content
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

Constant-folding for partial-evaluation residuals #813

Open
2 tasks
cdisselkoen opened this issue Apr 24, 2024 · 0 comments
Open
2 tasks

Constant-folding for partial-evaluation residuals #813

cdisselkoen opened this issue Apr 24, 2024 · 0 comments
Labels
backlog We hope to work on this in the future feature-request Request for a new feature

Comments

@cdisselkoen
Copy link
Contributor

Category

User level API features/changes

Describe the feature you'd like to request

Partial-evaluation residuals currently exhibit many missed opportunities for constant-folding, e.g., true && and && true in many positions. In some cases, true && or && true cannot be safely eliminated, e.g., if we don't know that the other side will evaluate to Boolean-or-error. (E.g.: 3 && true cannot be safely reduced to 3, as the former expression will error and the latter will not.) But there are still cases where we could constant-fold and do not today. In particular, nested occurrences of a && true && true should be always OK to simplify to a && true at a minimum. Generalizing this, there are many AST nodes we know must always return Boolean-or-error (&&, ||, .contains(), etc), and for all of these, we can eliminate true && or && true.

Describe alternatives you've considered

Status quo has the same semantics. This is mainly a readability issue for residuals.

Additional context

No response

Is this something that you'd be interested in working on?

  • 👋 I may be able to implement this feature request
  • ⚠️ This feature might incur a breaking change
@cdisselkoen cdisselkoen added backlog We hope to work on this in the future feature-request Request for a new feature labels Apr 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backlog We hope to work on this in the future feature-request Request for a new feature
Projects
None yet
Development

No branches or pull requests

1 participant