3 ms·
Most comments there do not go far enough back in time but refer only to later languages that have inherited the operators from other earlier languages. Regardi
by adrian_b 3y ago
Most comments there do not go far enough back in time but refer only to later languages that have inherited the operators from other earlier languages.
Regarding the logical operators, in mathematics, many decades before the first programming languages, the symbols were:
"∧ U+2227;LOGICAL AND"
"∨ U+2228;LOGICAL OR"
Either "∼ U+223C;TILDE OPERATOR" or "¬ U+00AC;NOT SIGN"
Many early programming languages, e.g. Algol 60, CPL, IBM APL\360, used these (Algol 60 used "¬", McCarthy, CPL and APL used "~").
IBM FORTRAN IV (1962) was meant to be used with IBM printers with poor character sets, so it used ".AND.", ".OR.", and ".NOT.".
The next IBM language, IBM NPL (December 1964) replaced the FORTRAN IV keywords with "&", "|" and "¬" (because these symbols were included in the IBM EBCDIC character set, while "U+2227;LOGICAL AND" and "U+2228;LOGICAL OR" were not included).
The next year NPL was rebranded as PL/I and all the languages that use "&" and "|" have taken them directly or indirectly from PL/I.
The languages B and C have taken their symbols and keywords from 3 sources, BCPL, PL/I and Algol 68. The logical operators were taken from PL/I.
By the time of B, ASCII had been standardized and it did not include "¬ U+00AC;NOT SIGN".
Because of this, B had to replace in the PL/I operators "¬" with an unused ASCII symbol, "!".
In B, "&" and "|" were ambiguous, depending on the context they were interpreted as either bit string operators or as "McCarthy AND" and "McCarthy OR".
C has resolved the ambiguity by adding "&&" and "||", and then it has added "~" for bit string not, which had already been used for this purpose in mathematics and in earlier programming languages.
- deleted 3y ago[deleted]
- fanf2 3y agoThe classic ∧ ∨ symbols from mathematical logic have been used in a few languages, often spelled /\ \/ After CPL they turn up in Miranda (as the weirdly asymmetrical & \/) and in Occam I thought there were more, but I can’t find them right now.
- eternityforest 3y agoI like how Python resolves ambiguity. When you see English text, it works at a high level on objects. If you see ASCII characters, it looks like C, you know you're messing with low level granular elements like you might commonly do in C.