Skip to content

Variadic logical operators #32

Open
@JimLarson

Description

@JimLarson

The current AST representation of the logical operators (||, &&) are 2-argument calls only, so a CEL expression like x || y || z is represented as _||_( _||_(x, y), z). Some users automatically generate CEL expressions that contain large sequences of one logical operator or the other, which creates a lopsided call tree which can violate the recursion limit for protocol buffer implementations.

Currently, there is a workaround which converts the lopsided tree into a more balanced tree. Since the logical operators are associative, this doesn't change the semantics. However, makes proto-level comparison of ASTs from different parsers sensitive to the precise balancing algorithm used. It also only changes O(N) depth to O(log N).

Instead, the logical operators should simply be variadic, i.e. _||_(x, y, z) for the example above. No changes are required to the syntax, but the type checker and all runtimes would need to be able to support the new usage.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions