|
From: | Ed Morton |
Subject: | Re: gawk-5.1.1 bug report |
Date: | Wed, 6 Apr 2022 09:02:56 -0500 |
User-agent: | Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0 |
On 4/6/2022 3:13 AM, Paul Eggert wrote:
"f(x) && f(y)" simply states that f(y) wont be evaluated when f(x) is false, it doesn't imply anything about whether it's important that that be the case or not. On the other hand, "f(x) & f(y)" would imply that it's important that f(y) SHOULD be evaluated whether f(x) is true or false because why else would you write "&" instead of "&&" in a compound condition context?On 4/6/22 00:04, arnold@skeeve.com wrote:IMHO clear code beats saving a single branchSure, but clarity also argues for "&" over "&&" here. Writing "f(x) && f(y)" would incorrectly imply that it's important that f(y) should not be evaluated when f(x) is false
Ed.
, an implication that is incorrect here. Writing "f(x) & f(y)" tells the reader that both sides are safe to evaluate and that they can be evaluated in either order, something I found worth knowing when I read that part of the code.
[Prev in Thread] | Current Thread | [Next in Thread] |