- From: Simon Sapin <simon.sapin@exyr.org>
- Date: Mon, 23 Mar 2015 20:11:04 +0100
- To: www-style@w3.org
On 23/03/15 19:58, Boris Zbarsky wrote: > On 3/23/15 2:26 PM, Simon Sapin wrote: >> On 23/03/15 18:56, Henrik Andersson wrote: >>> Given that or traditionally has lower predecease than and, it's >>> certainly confusing. >> >> It does? I thought it more common for these operators to have the same >> precedence and be left-associative. > > C, C++, Java, Go, JavaScript (I claim "C-inspired" here): && has higher > precedence than || > > Python: "and" has higher precedence than "or". > > Perl: "and" has higher precedence than "or". > > Lisps: no weird precedence rules needed. ;) > > Haskell: && has higher precedence than ||. > > FORTRAN: Afaict, .AND./& has higher precedence than .OR./| > > Spreadsheets: typically AND and OR are functions, not operators. > > Visual Basic: And has higher precedence than Or. > > COBOL: AND has higher precedence than OR. > > Pascal: and has higher precedence than or. > > PHP: && has higher precedence than ||. > > Awk: && has higher precedence than ||. > > Mathematica: Afaict, && has higher precedence than ||. > > OCaml: && has higher precedence than ||. > > The only case I can think of offhand that I'm familiar with where > boolean "and" has the same precedence as boolean "or" is Unix shell job > control, where && and || are in fact equal precedence and left-associative. > > -Boris > > Source: http://rosettacode.org/wiki/Operator_precedence mostly. I was wrong, including for languages I was specifically thinking of. Regardless, that doesn’t change the original issue of this thread. -- Simon Sapin
Received on Monday, 23 March 2015 19:11:28 UTC