From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=HTML_MESSAGE, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 21851 invoked from network); 15 May 2020 09:33:42 -0000 Received: from minnie.tuhs.org (45.79.103.53) by inbox.vuxu.org with ESMTPUTF8; 15 May 2020 09:33:42 -0000 Received: by minnie.tuhs.org (Postfix, from userid 112) id DA9619C964; Fri, 15 May 2020 19:33:38 +1000 (AEST) Received: from minnie.tuhs.org (localhost [127.0.0.1]) by minnie.tuhs.org (Postfix) with ESMTP id B7B589C677; Fri, 15 May 2020 19:33:02 +1000 (AEST) Received: by minnie.tuhs.org (Postfix, from userid 112) id 9F9989C677; Fri, 15 May 2020 19:32:59 +1000 (AEST) X-Greylist: delayed 5801 seconds by postgrey-1.36 at minnie.tuhs.org; Fri, 15 May 2020 19:32:57 AEST Received: from sys10.scotnet.net (relay.scotnet.co.uk [217.16.223.20]) by minnie.tuhs.org (Postfix) with ESMTP id 014839C668 for ; Fri, 15 May 2020 19:32:57 +1000 (AEST) Received: from [192.168.0.112] (94.197.14.55.threembb.co.uk [94.197.14.55]) (authenticated bits=0) by sys10.scotnet.net (8.13.6/8.13.5) with ESMTP id 04F7tjsL028505; Fri, 15 May 2020 08:56:05 +0100 Content-Type: multipart/alternative; boundary="Apple-Mail=_B8AFB987-E2B3-4D18-901D-B6235154FD33" Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) From: Dr Iain Maoileoin In-Reply-To: Date: Fri, 15 May 2020 08:55:46 +0100 Message-Id: References: <202005141841.04EIfvEZ063529@tahoe.cs.Dartmouth.EDU> To: Rob Pike X-Mailer: Apple Mail (2.3124) Subject: Re: [TUHS] v7 K&R C X-BeenThere: tuhs@minnie.tuhs.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: The Unix Heritage Society mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: The Eunuchs Hysterical Society , Doug McIlroy Errors-To: tuhs-bounces@minnie.tuhs.org Sender: "TUHS" --Apple-Mail=_B8AFB987-E2B3-4D18-901D-B6235154FD33 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 Being Scottish and in the 70s our world was constrained by UK import = restrictions - to protect our industries. As a boy I cut my teeth on a = language called Algol68 that ran on a ICL 1904 (24 bit word and 6 bit = byte, generally a capital letter only system!).=20 The language was part of my academic course work. OK it was not a OO language but - in 1968 - it had strict type checking, = structures, user-defined types, enums, void, casts, user-defined = operators (overloaded) both infix and prefix, (all defined on a formal = mathematical basis giving syntax and semantics) Together with = =E2=80=9Cenvironment enquiries=E2=80=9D to find out how big an int was = or the precision of a float. Users could also define their own operators - think about it as no more = that strange names of a variable or procedure - and also allocate = priority to the various operators in that world (monadics ALWAYS had a = priority of 10 and bound tightest). But it went too far. You could = define (note that the concept of +=3D did not exist in the base = language in 1968) a new operator such as =E2=80=9C+:=3D=E2=80=9C =20 op +:=3D =3D (ref in a, int b) ref int: a:=3Da+b; =E2=82=AC It took a = pointer to an int, and int and returned the pointer [Of course you could also define it to be op +:=3D =3D (ref in a, int b) ref int: a:=3Da-b+7; ] You could even use Jensen=E2=80=99s device with operators. If you dont = know ALgol68 have a speed read of = https://research.vu.nl/ws/portalfiles/portal/74119499/11057 My move to unix and C in the 70s was a huge retro step for me - but I = could not develop systems code in Algol68 - for example the transput = library was about 8K before your blinked. Certainly in C we could code = more and faster - no type-checking and we had enuf experience of = compilers to understand what was going on at the machine code level - we = could just drive the I/O registers directly. =20 Then C++? Like microsoft windows I evaluated, tried it a bit and voted = the theory good but the smell bad. I had a few students who wrote in = C++ over a few years, but you know what, it did not do anything earth = shattering and it could be a b*gger to work on a debug of a 20K line = student program! Like some here I think C++ was just on the wrong side = of a line that I dont understand. Similarly, for me, perl is on one = side of that line and python is far over the other side. My question is: What is that line? I dont understand it? Effort input vs output? = Complexity measure, debugging complexity in a 3rd party program? [I = hated assembler too unless it was my own (or good) ;-)] But machine = code was good, few people would do too much in a complicated way writing = in binary/octal/hex! > On 15 May 2020, at 03:44, Rob Pike wrote: >=20 > Perhaps for the first time in my career, I am about to disagree with = Doug McIlroy. Sorry, Doug, but I feel the essence of object-oriented = computing is not operator overloading but the representation of = behavior. I know you love using o.o. in OO languages, but that is = syntax, not semantics, and OO, not o.o., is about semantics. >=20 > And of course, the purest of the OO languages do represent arithmetic = as methods, but the fit of OO onto C was never going to be smooth. >=20 > -rob >=20 >=20 > On Fri, May 15, 2020 at 4:42 AM Doug McIlroy > wrote: > > o operator overloading > > > > I never could figure out why Stroustrup implemented that "feature"; = let's > > see, this operator usually means this, except when you use it in = that > > situation in which case it means something else. Now, try debugging = that. >=20 > Does your antipathy extend to C++ IO and its heavily overloaded << and = >>? >=20 > The essence of object-oriented programming is operator overloading. If = you > think integer.add(integer) and matrix.add(matrix) are good, = perspicuous, > consistent style, then you have to think that integer+integer and > matrix+matrix are even better. To put it more forcefully: the OO style > is revoltingly asymmetric. If you like it why don't you do everyday > arithmetic that way? >=20 > I strongly encouraged Bjarne to support operator overloading, used it > to write beautiful code, and do not regret a bit of it. I will agree, > though, that the coercion rules that come along with operator (and > method) overloading are dauntingly complicated. However, for natural = uses > (e.g. mixed-mode arithmetic) the rules work intuitively and well. >=20 > Mathematics has prospered on operator overloading, and that's why I > wanted it. My only regret is that Bjarne chose to set the vocabulary = of > infix operators in stone. Because there's no way to inroduce new ones, > users with poor taste are tempted to recycle the old ones for = incongruous > purposes. >=20 > C++ offers more features than C and thus more ways to write obscure = code. > But when it happens, blame the writer, not the tool. >=20 > Doug >=20 --Apple-Mail=_B8AFB987-E2B3-4D18-901D-B6235154FD33 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8 Being Scottish and in the 70s our world was constrained by UK = import restrictions - to protect our industries.  As a boy I cut my = teeth on a language called Algol68 that ran  on a ICL 1904 (24 bit = word and 6 bit byte, generally a capital letter only system!). 
The language was part of my academic course work.

OK it was not a OO = language but - in 1968 - it had strict type checking, structures, = user-defined types, enums, void, casts, user-defined operators = (overloaded) both infix and prefix,  (all defined on a formal = mathematical basis giving syntax and semantics)  Together with = =E2=80=9Cenvironment enquiries=E2=80=9D  to find out how big an int = was or the precision of a float.

Users could also define their own = operators - think about it as no more that strange names of a variable = or procedure - and also allocate priority to the various operators in = that world (monadics ALWAYS had a priority of 10 and bound tightest). =  But it went too far.  You could define (note that the concept = of +=3D  did not exist in the base language in 1968) a new operator = such as =E2=80=9C+:=3D=E2=80=9C  

op +:=3D =3D (ref in a, int b) = ref int: a:=3Da+b;   =E2=82=AC It took a pointer to an int, and int = and returned the pointer

[Of course you could also define it to be
op= +:=3D =3D (ref in a, int b) ref int: a:=3Da-b+7;
]
You could even use Jensen=E2=80=99s device with operators. =  If you dont know ALgol68 have a speed read of https://research.vu.nl/ws/portalfiles/portal/74119499/11057=

My move to = unix and C in the 70s was a huge retro step for me - but I could not = develop systems code in Algol68 - for example the transput library was = about 8K before your blinked.  Certainly in C we could code more = and faster - no type-checking and we had enuf experience of compilers to = understand what was going on at the machine code level - we could just = drive the I/O registers directly.   

Then C++?  Like microsoft windows = I evaluated, tried it a bit and voted the theory good but the smell bad. =    I had a few students who wrote in C++ over a few years, but = you know what, it did not do anything earth shattering and it could be a = b*gger to work on a debug of a 20K line student program!  Like some = here I think C++ was just on the wrong side of a line that I dont = understand.  Similarly, for me,  perl is on one side of that = line and python is far over the other side.

My question is:
What= is that line?  I dont understand it?  Effort input vs output? =  Complexity measure,  debugging complexity in a 3rd party = program?  [I hated assembler too unless it was my own (or good) = ;-)]  But machine code was good, few people would do too much in a = complicated way writing in binary/octal/hex!


On 15 May 2020, at 03:44, Rob Pike <robpike@gmail.com> = wrote:

Perhaps for the first time in my career, I am = about to disagree with Doug McIlroy. Sorry, Doug, but I feel the essence = of object-oriented computing is not operator overloading but the = representation of behavior. I know you love using o.o. in OO languages, = but that is syntax, not semantics, and OO, not o.o., is about = semantics.

And of = course, the purest of the OO languages do represent arithmetic as = methods, but the fit of OO onto C was never going to be smooth.

-rob


On Fri, May 15, 2020 at 4:42 AM Doug McIlroy <doug@cs.dartmouth.edu> wrote:
> o operator overloading
>
> I never could figure out why Stroustrup implemented that "feature"; = let's
> see, this operator usually means this, except when you use it in = that
> situation in which case it means something else.  Now, try = debugging that.

Does your antipathy extend to C++ IO and its heavily overloaded << = and >>?

The essence of object-oriented programming is operator overloading. If = you
think integer.add(integer) and matrix.add(matrix) are good, = perspicuous,
consistent style, then you have to think that integer+integer and
matrix+matrix are even better. To put it more forcefully: the OO = style
is revoltingly asymmetric. If you like it why don't you do everyday
arithmetic that way?

I strongly encouraged Bjarne to support operator overloading, used it
to write beautiful code, and do not regret a bit of it. I will agree,
though, that the coercion rules that come along with operator (and
method) overloading are dauntingly complicated. However, for natural = uses
(e.g. mixed-mode arithmetic) the rules work intuitively and well.

Mathematics has prospered on operator overloading, and that's why I
wanted it. My only regret is that Bjarne chose to set the vocabulary = of
infix operators in stone. Because there's no way to inroduce new = ones,
users with poor taste are tempted to recycle the old ones for = incongruous
purposes.

C++ offers more features than C and thus more ways to write obscure = code.
But when it happens, blame the writer, not the tool.

Doug


= --Apple-Mail=_B8AFB987-E2B3-4D18-901D-B6235154FD33--