You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Even assuming that all subexpressions are without side effects, sequences of addition (and subtraction) or multiplication (and addition) are order-sensitive and therefore cannot be safely balanced1. As a consequence, protobuf nesting limits result in a hard cap for the number of terms in a mathematical expressions and this cap also interacts with other structures such as nested parentheticals, function calls, and list/map/message construction. To get more control over #410 (in particular, to cap the number of terms in a mathematical expression consistently, without respect to other structures in the expression), I'd like to see support for variadic addition and multiplication2.
Is this feasible? I am a little shaky on what the commitment to forward- and backward-compatibility is for the current AST definition, though I assume forward compatibility of existing evaluators is not a hard requirement, given the in-progress updates to comprehensions.
Footnotes
For example, 1e16 + -1e16 + 1.0 does not equal 1e16 + 1.0 + -1e16 and 1 + -1 + 9223372036854775807 does not equal 1 + 9223372036854775807 + -1 (the latter producing an overflow error). ↩
Because subtraction and division share precedence with addition and multiplication, respectively, there would need to be a single variadic function for addition and subtraction and a single variadic function for multiplication and division — otherwise, alternating the same-precedent operations would again produce a deep expression that could not be safely rebalanced. ↩
The text was updated successfully, but these errors were encountered:
Even assuming that all subexpressions are without side effects, sequences of addition (and subtraction) or multiplication (and addition) are order-sensitive and therefore cannot be safely balanced1. As a consequence, protobuf nesting limits result in a hard cap for the number of terms in a mathematical expressions and this cap also interacts with other structures such as nested parentheticals, function calls, and list/map/message construction. To get more control over #410 (in particular, to cap the number of terms in a mathematical expression consistently, without respect to other structures in the expression), I'd like to see support for variadic addition and multiplication2.
Is this feasible? I am a little shaky on what the commitment to forward- and backward-compatibility is for the current AST definition, though I assume forward compatibility of existing evaluators is not a hard requirement, given the in-progress updates to comprehensions.
Footnotes
For example,
1e16 + -1e16 + 1.0
does not equal1e16 + 1.0 + -1e16
and1 + -1 + 9223372036854775807
does not equal1 + 9223372036854775807 + -1
(the latter producing an overflow error). ↩Because subtraction and division share precedence with addition and multiplication, respectively, there would need to be a single variadic function for addition and subtraction and a single variadic function for multiplication and division — otherwise, alternating the same-precedent operations would again produce a deep expression that could not be safely rebalanced. ↩
The text was updated successfully, but these errors were encountered: