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

[FEATURE] Lazy evaluation of && (and) operator #624

Closed
ModProg opened this issue Nov 24, 2022 · 0 comments · Fixed by #627
Closed

[FEATURE] Lazy evaluation of && (and) operator #624

ModProg opened this issue Nov 24, 2022 · 0 comments · Fixed by #627
Labels
enhancement New feature or request

Comments

@ModProg
Copy link
Contributor

ModProg commented Nov 24, 2022

Description of the requested feature

I noticed that all parts of an && expression are eagerly evaluated, e.g. a != null && a.smth will throw an error when a is null. (This is exspecially problematic with the elvis operator not working #623 .

Proposed configuration syntax

No changes, just change the evaluation to only evaluate the rest of an expression if it is actually relevant.

  1. if a prior value is true ignore the rest for ||
  2. if a prior value is false ignore the rest for &&

Additional context

Noticed this when my implementation here didn't actually work: #622 (comment) due to throwing null exceptions

@ModProg ModProg added the enhancement New feature or request label Nov 24, 2022
ModProg added a commit to ModProg/eww that referenced this issue Nov 26, 2022
elkowar pushed a commit that referenced this issue Jan 5, 2023
* Make some operators lazily evaluated

Fixes #624

* Add to CHANGELOG.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant