On Apr 3, 2022, at 5:25 PM, João Valverde <j@xxxxxx> wrote:
> I removed the "parenthesis around && within ||" warning/suggestion in [1], then noticed the precedence of AND and OR is flipped from most programming languages, then found [2].
>
> The consensus seemed to be in favor of being consistent with the rest of the world, but in the end it wasn't done.
>
> Should AND have higher precedence than OR?
Yes, especially if, as I seem to remember Gerald indicating would be the case, the next release will be 4.0 rather than 3.8. That's the order in C, and presumably in languages that follow "C" with one or more characters from the top row of the keyboard :-), as well as those preceding "C" with the word "Objective" :-), as well as Java, Perl, Python, Lua and BPF filters.
We should probably mention this very notably in the documentation, including the release notes, and recommend that people use parentheses in all packet-matching expressions that use both AND and OR.
We may want to have some sort of warning (with the different UI design) as well.