From: Dr Iain Maoileoin <iain@csp-partnership.co.uk>
To: Rob Pike <robpike@gmail.com>
Cc: The Eunuchs Hysterical Society <tuhs@tuhs.org>,
Doug McIlroy <doug@cs.dartmouth.edu>
Subject: Re: [TUHS] v7 K&R C
Date: Fri, 15 May 2020 08:55:46 +0100 [thread overview]
Message-ID: <D3259CA9-784C-4E37-888C-95D01E92ADB5@csp-partnership.co.uk> (raw)
In-Reply-To: <CAKzdPgworqAHGFATWOao8PEpXeVP48UvCq-iE94jsaCUOXBD5w@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 4911 bytes --]
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 “environment enquiries” 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 += did not exist in the base language in 1968) a new operator such as “+:=“
op +:= = (ref in a, int b) ref int: a:=a+b; € It took a pointer to an int, and int and returned the pointer
[Of course you could also define it to be
op +:= = (ref in a, int b) ref int: a:=a-b+7;
]
You could even use Jensen’s 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 <mailto: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
>
[-- Attachment #2: Type: text/html, Size: 7119 bytes --]
next prev parent reply other threads:[~2020-05-15 9:33 UTC|newest]
Thread overview: 139+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-14 18:41 Doug McIlroy
2020-05-14 18:45 ` Richard Salz
2020-05-14 20:54 ` Clem Cole
2020-05-15 2:44 ` Rob Pike
2020-05-15 3:57 ` Rich Morin
2020-05-15 7:55 ` Dr Iain Maoileoin [this message]
2020-05-15 15:01 ` Larry McVoy
2020-05-15 15:36 ` John P. Linderman
2020-05-15 20:01 ` ron
2020-05-15 20:03 ` Larry McVoy
2020-05-15 20:05 ` Clem Cole
2020-05-15 20:18 ` ron
2020-05-15 20:24 ` Clem Cole
2020-05-16 0:57 ` Brantley Coile
2020-05-16 16:14 ` Dan Cross
2020-05-15 20:56 ` Steve Nickolas
2020-05-16 0:31 ` Peter Jeremy
2020-05-16 8:30 ` Steve Nickolas
2020-05-16 0:43 ` John P. Linderman
2020-05-16 16:28 ` Paul Winalski
2020-05-16 17:39 ` Warner Losh
2020-05-19 19:45 ` Peter Pentchev
2020-05-20 3:52 ` Rich Morin
2020-05-21 15:06 ` Dave Horsfall
-- strict thread matches above, loose matches on Subject: below --
2020-05-19 12:29 Noel Chiappa
2020-05-19 2:29 Doug McIlroy
2020-05-19 3:20 ` Steve Nickolas
2020-05-18 14:33 Doug McIlroy
2020-05-18 13:58 Doug McIlroy
2020-05-16 18:45 Richard Tobin
2020-05-16 21:55 ` Ronald Natalie
2020-05-16 0:15 Nelson H. F. Beebe
2020-05-16 0:28 ` Steffen Nurpmeso
2020-05-16 1:52 ` Warner Losh
2020-05-16 16:31 ` Paul Winalski
2020-05-16 20:35 ` Brad Spencer
2020-05-16 20:37 ` Warner Losh
2020-05-18 12:25 ` Tony Finch
2020-05-15 21:31 Richard Tobin
2020-05-15 21:53 ` Steve Nickolas
2020-05-15 22:33 ` ron
2020-05-15 23:34 ` Steffen Nurpmeso
2020-05-16 1:26 ` Larry McVoy
2020-05-16 21:59 ` Ronald Natalie
2020-05-16 23:26 ` Steffen Nurpmeso
2020-05-17 16:24 ` Paul Winalski
2020-05-17 16:29 ` ron
2020-05-17 16:38 ` Paul Winalski
2020-05-17 20:08 ` Clem Cole
2020-05-18 8:46 ` Peter Jeremy
2020-05-19 7:41 ` Dave Horsfall
2020-05-18 12:04 ` Tony Finch
2020-05-18 13:10 ` Clem Cole
2020-05-18 15:13 ` Rich Morin
2020-05-18 15:51 ` Brantley Coile
2020-05-18 16:11 ` Dan Cross
2020-05-18 21:18 ` ron
2020-05-17 16:10 ` Derek Fawcus
2020-05-17 16:14 ` ron
2020-05-15 20:34 Doug McIlroy
2020-05-15 20:40 ` Warner Losh
[not found] <mailman.1.1589421601.13778.tuhs@minnie.tuhs.org>
2020-05-14 3:02 ` Paul McJones
2020-05-14 17:08 ` Paul Winalski
2020-05-14 17:58 ` Clem Cole
2020-04-27 17:45 Noel Chiappa
2020-04-27 17:56 ` Richard Salz
2020-04-27 18:02 ` Brantley Coile
2020-04-27 18:47 ` Derek Fawcus
2020-04-25 19:41 Noel Chiappa
2020-04-25 20:27 ` Steffen Nurpmeso
2020-04-25 13:11 Noel Chiappa
2020-04-25 13:18 ` Rob Pike
2020-04-25 14:57 ` Warner Losh
2020-04-25 18:03 ` Noel Chiappa
2020-04-25 20:11 ` Michael Kjörling
2020-04-25 21:27 ` Brian L. Stuart
2020-04-26 0:07 ` emanuel stiebler
2020-04-26 0:54 ` Rob Pike
2020-04-26 19:37 ` Derek Fawcus
2020-04-26 20:10 ` Derek Fawcus
2020-04-26 21:59 ` Rich Morin
2020-04-26 22:38 ` Noel Hunt
2020-04-26 23:57 ` Nemo Nusquam
2020-04-27 3:38 ` Rob Pike
2020-04-25 13:35 ` Hellwig Geisse
2020-04-25 13:59 ` Richard Salz
2020-04-25 19:01 ` Brian L. Stuart
2020-04-25 20:07 ` Michael Kjörling
2020-04-25 21:34 ` Brian L. Stuart
2020-04-26 6:40 ` arnold
2020-04-25 1:59 Adam Thornton
2020-04-25 2:37 ` Charles Anthony
2020-04-25 2:47 ` Adam Thornton
2020-04-25 2:51 ` Rob Pike
2020-04-25 2:54 ` Rob Pike
2020-04-25 3:04 ` Larry McVoy
2020-04-25 3:30 ` Clem Cole
2020-04-25 3:43 ` Larry McVoy
2020-04-25 3:54 ` Jon Steinhart
2020-04-25 11:44 ` Michael Kjörling
2020-04-25 13:17 ` Dan Cross
2020-05-11 0:28 ` scj
2020-05-11 0:32 ` Rob Pike
2020-05-11 0:57 ` Larry McVoy
2020-05-11 17:32 ` Greg A. Woods
2020-05-11 18:25 ` Paul Winalski
2020-05-11 18:37 ` Clem Cole
2020-05-11 19:12 ` Paul Winalski
2020-05-11 19:57 ` joe mcguckin
2020-05-11 20:25 ` Larry McVoy
2020-05-12 17:23 ` Paul Winalski
2020-05-12 17:35 ` ron
2020-05-12 17:42 ` Larry McVoy
2020-05-12 18:36 ` Paul Winalski
2020-05-13 23:36 ` Dave Horsfall
2020-05-14 0:42 ` John P. Linderman
2020-05-14 2:44 ` Rich Morin
2020-05-14 3:09 ` Charles Anthony
2020-05-14 12:27 ` ron
2020-05-14 12:27 ` ron
2020-05-14 12:27 ` ron
2020-05-14 7:38 ` Dave Horsfall
2020-05-14 12:25 ` ron
2020-05-14 17:13 ` Paul Winalski
2020-05-14 17:21 ` Larry McVoy
2020-05-17 16:34 ` Derek Fawcus
2020-05-14 4:21 ` Greg A. Woods
2020-05-14 4:40 ` Warner Losh
2020-05-14 17:32 ` Larry McVoy
2020-05-14 22:32 ` Tony Finch
2020-05-16 23:53 ` Steffen Nurpmeso
2020-05-17 0:35 ` Larry McVoy
2020-05-11 18:37 ` Larry McVoy
2020-05-11 2:08 ` Lawrence Stewart
2020-05-11 11:36 ` Michael Kjörling
2020-04-25 3:37 ` Dave Horsfall
2020-04-27 13:19 ` Tony Finch
2020-04-25 2:50 ` Adam Thornton
2020-04-25 5:59 ` Lars Brinkhoff
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=D3259CA9-784C-4E37-888C-95D01E92ADB5@csp-partnership.co.uk \
--to=iain@csp-partnership.co.uk \
--cc=doug@cs.dartmouth.edu \
--cc=robpike@gmail.com \
--cc=tuhs@tuhs.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).