gm2
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: CHAR as FOR loop control variable


From: Benjamin Kowarsch
Subject: Re: CHAR as FOR loop control variable
Date: Wed, 3 May 2023 22:37:28 +0900

Hi Gaius

On Wed, 3 May 2023 at 21:27, Gaius Mulley wrote:

indeed - it is quite surprising the amount of operator overloading
occurring for a non OO language :-).  All great fun though!  For example
the '+' symbol: CHAR, INTEGER (ordinal), FLOAT, COMPLEX, string and SET
types - all interesting and different

 Well, pretty much all languages use the arithmetic operators with multiple numeric types, and that makes a lot of sense.

The trouble begins when things become non-obvious and thus misleading, or worse, ambiguous.

Of course a large part of the blame goes to the incompetence of the ASCII committee who were so obsessed with teletypes that they couldn't even think five seconds into the future and wasted all those code points on totally unnecessary teletype control codes instead of assigning all teletype commands to a single code with a second code to select the actual command and thereby freeing up more code points for useful symbols, such as the math symbols for set union, set intersection, set difference, subset, superset, and others like logical not, logical and and logical or.

But even with the limited set of symbols in the ASCII set, there was no reason to use + for string concatenation. Either & or || could have been used. In fact it was warned against using + in the Milton Keynes meeting but such is the dynamic of design by crowds that the worst choices tend to get selected by majority vote.

Also note that whilst the reuse of operators across different types is the original meaning of the term operator overloading, it has not been used with that meaning for decades as the meaning shifted to user definable operators, and it is that meaning with which OO languages are associated, not the original meaning. ;-)

regards
benjamin




reply via email to

[Prev in Thread] Current Thread [Next in Thread]