News for hackers. Stuff that matters.
Re:Dennis Ritchie on the priorities of && || vs. == etc. (1982) by namrog84 on Friday January 05, 2024 @05:34PM (#38885948)
While true and might be easy to read in the example context of a b c I'd imagine having the && separator in real world conditions to be far more readable and clear for vast majority if people
Re:Dennis Ritchie on the priorities of && || vs. == etc. (1982) by TylerE on Friday January 05, 2024 @07:37PM (#38887018)
Pipe looks far too much like a 1 or lowercase ell.
Re:Dennis Ritchie on the priorities of && || vs. == etc. (1982) by trealira on Saturday January 06, 2024 @04:13AM (#38889841)
I actually think the variadic logical and is more readable, and wish more languages had it. As long as all the arguments are lined up vertically, you can think of it as a sequence of tests for true that exits at the first failure. It's more obvious with the variadic operator. Contrived comparison:

  if (a != null && x != 0 && a.use_it(x))
  {
      ...
  }


  (if (and (not (null a))
           (/= 0 x)
           (use-it a x))
      ...)