|
|
|
|
|
by linux2647
1739 days ago
|
|
I’m all for experimenting with languages, but there is something to be said for having a familiar syntax. Using & and | for Boolean logic operators could be seen as a useful improvement, but then how does one express bitwise and and or? Additionally, all numbers are floating point. Would there be any future support for native integers? Handling currency with floating point has long been known to cause rounding errors. Despite that, it’s interesting to see a language put dependency injection at the core of the language. I’d be curious to see how that works out in the long term. |
|
The predecessors of C, i.e. B and BCPL also had both kinds of operators but they used the same symbols for them (in B: & | !) and the context determined which was meant.
However the choice made by C for the new symbols was constrained by the ASCII code, which had no other available symbols.
One decade before the C language, there were 6 symbols in use for the 3 logical or bit string operators, for example IBM PL/I used & | and NOT SIGN, while CPL and IBM APL\360 used LOGICAL AND, LOGICAL OR and TILDE OPERATOR.
The names in capitals are the Unicode names of the symbols.
So there are enough traditional symbols for both the McCarthy logical operators and for the bit string operators, without inventing any new symbols, like C did.
In my opinion, the IBM PL/I set of 3 symbols (& | NOT SIGN) is appropriate for the McCarthy logical operators, while the CPL / IBM APL\360 set of 3 symbols is appropriate for the bit string operators.
The reason is that & and | are more visually distinct so they are preferable in IF or WHILE conditions.
On the other hand, the bit string "and" and "or" are nothing else but "min" and "max" applied to vectors of 1-bit numbers. So the symbols LOGICAL AND and LOGICAL OR are also the right choice as symbols for "min" and "max". Because the LOGICAL AND and the LOGICAL OR symbols are just rotated LESS THAN and GREATER THAN, they are graphically suitable for "min" and "max".