3 ms·
The Alto thread posted a ref to BCPL, and it was interesting that the original symbols for the comparison operators were text: eq, ne, gt, lt. C broke BCPL syn
by TheOtherHobbes 10y ago
The Alto thread posted a ref to BCPL, and it was interesting that the original symbols for the comparison operators were text: eq, ne, gt, lt.
C broke BCPL syntax that was clear, memorable, and consistent and replaced it with a math-like syntax that must have wasted millions of person hours of debugging time in the decades since - for no good reason.
Similarly &(pointer address) and &&(logical and) are too close and too easy to typo.
Language design really should have considered human factors much more than it did.
- dsp1234 10y agoInterestingly, Powershell uses eq, ne, gt, lt, etc for its comparison operators.
- 13of40 10y agoThe historical reason behind that is the > and | symbols were used as redirection operators to follow shell conventions so they used -gt and -bor. All of the other operators followed for consistency. There was also a big kerfuffle about statements like "$a = 1" or "$a++" not being able to return values like in C because if they were used stand-alone the return value would be printed out by the host.
- mkesper 10y agoYes, this always gets me. I don't like perl-style at all. Compare the cognitive load of distinguishing -lt and -le vs. < and <=.
- groovy2shoes 10y ago> Similarly &(pointer address) and &&(logical and) are too close and too easy to typo. Not to mention &(bitwise and).