|
|
|
|
|
by beagle3
4723 days ago
|
|
No, laziness. && is pronounced "and" but actually means "shortcircuit left-to-right-evaluated and". If you're coming from a Pascal (or non-programming) background, you do not assume either left-to-right evaluation order, nor short circuit evaluation. The cognitive overhead is always there, because whether you like to admit it or not, programming is applied math, and exact meaning is very important; e.g.: if a == 0.0 or b/a > 3 then launch_missile();
Without the "cognitive overhead of knowning guaranteed left-to-right + short circuit", this code is wrong.The hypothetical "newbie programmer who can write a working program but has cognitive overhead deciphering &&" is a mythical creature that does not actually exist. |
|