From: Douglas McIlroy <douglas.mcilroy@dartmouth.edu>
To: COFF <coff@tuhs.org>
Subject: [COFF] Re: ancient macros, machine code translation,as mental architecture models
Date: Mon, 15 Jul 2024 08:37:57 -0400 [thread overview]
Message-ID: <CAKH6PiVb58TJ=5MuR_C_GQpb0hVfAoyFLEJJq2v9X11oi3dP8A@mail.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 1534 bytes --]
In 1959, when Doug Eastwood and I, at the suggestion of George Mealy, set
out to add macro capability to SAP (Share assembly program), the word
"macro"--short for "macroinstruction"--was in the air, though none of us
had ever seen a macroprocessor. We were particularly aware that GE had a
macro-capable assembler. I still don't know where or when the term was
coined. Does anybody know?
We never considered anything but recursive expansion, where macro
definitions can contain macro calls; thus the TX-0 model comes as quite a
surprise. We kept a modest stack of the state of each active macro
expansion. We certainly did not foresee that within a few years some
applications would need a 70-level stack!
General stack-based programming was not common practice (and the term
"stack" did not yet exist). This caused disaster the first time we wrote a
macro that generated a macro definition, because a data-packing subroutine
with remembered state, which was used during both definition and expansion,
was not reentrant. To overcome the bug we had in effect to introduce
another small stack to keep the two uses out of each other's way. Luckily
there were no more collisions between expansion and definition. Moreover,
this stack needed to hold only one suspended state because expansion could
trigger definition but not vice versa.
Interestingly, the problem in the previous paragraph is still with us 65
years later in many programming languages. To handle it gracefully, one
needs coroutines or higher-order functions.
Doug
[-- Attachment #2: Type: text/html, Size: 1729 bytes --]
next reply other threads:[~2024-07-15 12:38 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-15 12:37 Douglas McIlroy [this message]
2024-07-15 14:26 ` Paul Winalski
2024-07-15 14:38 ` Bakul Shah via COFF
2024-07-15 19:39 ` John Levine
2024-07-16 19:55 ` Aron Insinga
2024-07-16 20:09 ` Aron Insinga
2024-07-17 17:00 ` [COFF] Re: ancient macros Aron Insinga
-- strict thread matches above, loose matches on Subject: below --
2024-07-13 23:46 [COFF] Re: machine code translation,as mental architecture models John Levine
2024-07-13 22:00 ` Douglas McIlroy
2024-07-14 0:56 ` Aron Insinga
2024-07-14 18:02 ` [COFF] Re: ancient macros, " John Levine
2024-07-15 1:44 ` Aron Insinga
2024-07-15 14:09 ` Paul Winalski
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='CAKH6PiVb58TJ=5MuR_C_GQpb0hVfAoyFLEJJq2v9X11oi3dP8A@mail.gmail.com' \
--to=douglas.mcilroy@dartmouth.edu \
--cc=coff@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).