Skip to content

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

@Kijewski

Description

@Kijewski

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions