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

In an if condition with conjuctions && and disjunctions ||, should each term be "boolified"? #201

Open
Kijewski opened this issue Oct 16, 2024 · 0 comments · May be fixed by #203
Open

In an if condition with conjuctions && and disjunctions ||, should each term be "boolified"? #201

Kijewski opened this issue Oct 16, 2024 · 0 comments · May be fixed by #203

Comments

@Kijewski
Copy link
Collaborator

Kijewski commented Oct 16, 2024

In a condition {% if (a || b) && (c || d) %}, rinja ensures that the whole expression P is a bool by (de)referencing as needed: *((&P) as &bool). I think it would be better if each term was "boolified" B:

-B((a || b) && (c || d))
+B((B(a) || B(b)) && (B(C) || B(D)))

This "boolification" should be done for the outmost term of a condition, and any nested conjuctions and disjuctions. Any sub-expression that is not …||…, …&&… or !… should end the recursive boolification.

Compare redlib-org/redlib#290.

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 a pull request may close this issue.

1 participant