The Unix Heritage Society mailing list
 help / color / mirror / Atom feed
From: Dan Cross <crossd@gmail.com>
To: John Cowan <cowan@ccil.org>
Cc: tuhs@tuhs.org
Subject: [TUHS] Re: python
Date: Fri, 4 Aug 2023 11:17:48 -0400	[thread overview]
Message-ID: <CAEoi9W68eSGZhwy2-ugRXbWLsoNM4c0he4kVFTWJ2Qs9-2E0vw@mail.gmail.com> (raw)
In-Reply-To: <CAD2gp_SgREmXNRuoLsqWUhbUS5EaSNVkC0xXuonTJ7nCpB_hbg@mail.gmail.com>

On Thu, Aug 3, 2023 at 8:24 PM John Cowan <cowan@ccil.org> wrote:
> On Thu, Aug 3, 2023 at 6:06 PM Dan Cross <crossd@gmail.com> wrote:
>> someone had needed to store a
>> pair of integers, so they used a CONS cell;
>
> Of course, that was a bad idea.  The pair of integers should have been a struct or a class named after whatever its application-level purpose was: a point, for example.

Probably, but I didn't write the original code, or even make the
change; I did submit the fix, however. :-)

An issue with CLs aggregation primitives is that they can be
expensive, however. QPX was weird; despite things that have been said
about it publicly (http://www.paulgraham.com/carl.html) QPX was not a
"typical" Lisp program: it is more like FORTRAN written in
S-expressions (many thousand-line Lisp functions with jumps between
various points inside of them are common; those functions like, say,
setq [not setf] a boolean on line 1387, and then reference it on
3298...kind of a mess, but that's what you need to make Lisp fast).

>> after a while, the pair
>> needed to be expanded to a triple, so someone converted the single
>> CONS cell into a (proper) list.
>
> In that case, a derived struct or class should have been created.  The two classes would use the same accessor methods, just as in C++.

Of course, we all knew this. But when you've got an O(10^6) line
codebase that's extremely fragile, technology and business limitations
demand tradeoffs that are not always what the engineers would choose.

>> this, of course, ran afoul of the type system and
>> raised a condition, which resulted as an ISE in prod. The fix was
>> trivial (change CDR to SECOND in the right place) but it really struck
>> me that if the system were statically typed, this would have been
>> trivially discovered at compile-time.
>
> Absolutely, and if the failure was intolerable, CL's static type declarations would have caught the use of the wrong type.  But you don't have to declare *everything*.  For that matter, there is nothing in a fully statically typed system that requires every variable, function, argument, etc. to be *declared*: type inference is powerful.

Not really, unless they were used consistently across the entire
codebase (and sadly, they were not).

>> Common Lisp does allow you to declare types in some limited regards;
>> these are usually hints to the compiler for code generation.
>
> They may or may not be, depending on how you set the OPTIMIZE declaration.
>
>> like Rob, I
>> greatly prefer strong, static typing.
>
> Then why weren't you using mypy?

Because it didn't exist at the time (the early 2010s), or if it did,
it was in a very nascent state.

>> Incidentally, C is weakly (you can add a pointer to an integer: the
>> result is another pointer), but statically typed.
>
> That's not weak typing, it's operator overloading, just as when you add an int to a double. C will not let you, e.g., add an int to a function.

I think there's a bit of a debate as to whether C is weakly or
strongly typed (and certainly, these exist on a spectrum), and some
good judges say it's "moderately typed". I've never heard anyone refer
to implicit type conversions as "operator overloading", however.

> Weak typing is quite rare in high-level languages: PL/I pointer variables are weakly typed (that is, when you allocate an object you specify the type of the object and then assign it to the pointer variable), but the rest of the language is strongly typed.

Once `memcpy` and `void *` are in the mix, all bets are off in C.

        - Dan C.

  reply	other threads:[~2023-08-04 15:18 UTC|newest]

Thread overview: 86+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-30 18:22 [TUHS] Re: Cool talk on Unix and Sendmail history, by Eric Allman Norman Wilson
2023-07-30 21:43 ` Rob Pike
2023-07-30 23:34   ` George Michaelson
2023-07-30 23:59     ` Erik E. Fair
2023-07-31  0:26       ` Warner Losh
2023-07-31 22:57         ` Grant Taylor via TUHS
2023-07-31 23:05           ` Warner Losh
2023-08-01  2:45             ` Grant Taylor via TUHS
2023-08-01  1:51         ` Niklas Karlsson
2023-08-01  2:47           ` Grant Taylor via TUHS
2023-08-01  3:20           ` Theodore Ts'o
2023-07-31  0:41       ` segaloco via TUHS
2023-08-01  9:22       ` Marc Donner
2023-08-01 10:58         ` Erik E. Fair
2023-08-02  0:37           ` Dave Horsfall
2023-08-02 14:52             ` Ron Natalie
2023-08-02 21:14               ` Grant Taylor via TUHS
2023-08-02 22:20                 ` segaloco via TUHS
2023-08-02 22:37                   ` Warner Losh
2023-08-02 23:49                   ` Rich Salz
2023-08-03  0:51                     ` [TUHS] Re: python Larry McVoy
2023-08-03  1:20                       ` George Michaelson
2023-08-03  2:53                         ` Bakul Shah
2023-08-03  2:55                         ` segaloco via TUHS
2023-08-03  3:24                         ` George Michaelson
2023-08-03  3:32                           ` Warner Losh
2023-08-03  3:55                           ` Bakul Shah
2023-08-03  8:32                             ` Rob Pike
2023-08-03 14:19                               ` Bakul Shah
2023-08-03 14:56                                 ` Dan Halbert
2023-08-03 15:20                                   ` will.senn
2023-08-03 22:05                                     ` Dan Cross
2023-08-04  0:24                                       ` John Cowan
2023-08-04 15:17                                         ` Dan Cross [this message]
2023-08-05  4:44                                       ` Bakul Shah
2023-08-03 15:41                                 ` John Cowan
2023-08-03  2:07                       ` Clem Cole
2023-08-03  2:21                         ` Pete Wright via TUHS
2023-08-03  2:56                           ` Warner Losh
2023-08-03 12:36                         ` Mike Markowski
2023-08-03 13:29                           ` Rob Pike
2023-08-03 15:24                             ` emanuel stiebler
2023-08-03 15:39                               ` Steffen Nurpmeso
2023-08-04  1:01                             ` Larry McVoy
2023-08-04  1:28                               ` segaloco via TUHS
2023-08-04  1:58                                 ` Adam Thornton
2023-08-04 15:04                                   ` Dan Cross
2023-08-04 15:10                                     ` Larry McVoy
2023-08-03 16:57                         ` [TUHS] Re: [TULSA] " Phil Budne
2023-08-03 17:00                           ` Rich Salz
2023-08-03 20:35                             ` [TUHS] Split addressing (I/D) space (inspired by the death of the python... thread) Will Senn
2023-08-03 21:05                               ` [TUHS] " Kenneth Goodwin
2023-08-03 21:10                                 ` Ronald Natalie
2023-08-03 21:16                                   ` Warner Losh
2023-08-03 21:24                                     ` Ronald Natalie
2023-08-03 22:34                                   ` Kenneth Goodwin
2023-08-03 21:05                               ` Ronald Natalie
2023-08-03 21:44                               ` Clem Cole
2023-08-03 22:08                                 ` Will Senn
2023-08-03 22:54                                   ` Clem Cole
2023-08-03 23:08                                     ` Dave Horsfall
2023-08-03 23:15                                     ` Clem Cole
2023-08-04  0:38                                     ` John Cowan
2023-08-03 17:29                           ` [TUHS] Re: [TULSA] Re: python Alejandro Colomar
2023-08-03 17:51                             ` John Cowan
2023-08-03 18:05                               ` Alejandro Colomar
2023-08-03 21:29                                 ` Dan Cross
2023-08-03 23:55                                   ` [TUHS] printf (was: python) Alejandro Colomar
2023-08-04 16:06                                     ` [TUHS] " Dan Cross
2023-08-04 16:57                                       ` Alejandro Colomar
2023-08-04 21:16                                         ` Dan Cross
2023-08-03 21:02                           ` [TUHS] Re: [TULSA] Re: python Steffen Nurpmeso
2023-08-03 23:47                           ` Larry McVoy
2023-08-03 23:54                             ` Will Senn
2023-08-04 19:20                         ` [TUHS] " Ed Bradford
2023-08-04 19:47                           ` Larry McVoy
2023-08-05  5:40                             ` Ed Bradford
2023-08-02 23:33               ` [TUHS] Re: Cool talk on Unix and Sendmail history, by Eric Allman Dave Horsfall
2023-08-04 20:11 [TUHS] Re: python Noel Chiappa
2023-08-04 20:15 ` Larry McVoy
2023-08-04 20:45   ` Adam Thornton
2023-08-04 21:17 Douglas McIlroy
2023-08-04 21:30 ` Dan Cross
2023-08-04 22:36 ` Rob Pike
2023-08-06 19:46 Norman Wilson
2023-08-07  6:48 ` Ed Bradford

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=CAEoi9W68eSGZhwy2-ugRXbWLsoNM4c0he4kVFTWJ2Qs9-2E0vw@mail.gmail.com \
    --to=crossd@gmail.com \
    --cc=cowan@ccil.org \
    --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).