The Unix Heritage Society mailing list
 help / color / mirror / Atom feed
From: Clem Cole <clemc@ccc.com>
To: Brian Walden <tuhs@cuzuco.com>
Cc: Computer Old Farts Followers <coff@tuhs.org>,
	TUHS main list <tuhs@minnie.tuhs.org>
Subject: Re: [TUHS] [TUHS -> moving to COFF] # and the Preprocessor
Date: Wed, 8 Jan 2020 11:02:41 -0500	[thread overview]
Message-ID: <CAC20D2Pd+gEu8AmsAjJ5vxT+GGfU8PyRXRD7Aux0v2-VUN0N8A@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 6522 bytes --]

below...  -- warning veering a little from pure UNIX history, but trying to
clarify what I can and then moving to COFF for follow up.

On Wed, Jan 8, 2020 at 12:23 AM Brian Walden <tuhs@cuzuco.com> wrote:

> ....
>
> - CMU's ALGOL68S from 1978 list all these ways --
>   co            comment
>   comment       comment
>   pr            pragmat
>   pragmat       pragmat
>   #             (comment symbol) comment
>   ::            (pragmat symbol) pragmat
>   (its for UNIX v6 or v7 so not surprising # is a comment)
>   http://www.softwarepreservation.org/projects/ALGOL/manual/a68s.txt/view

Be careful of overthinking here.   The comment in that note says was it was
for* PDP-11's *and lists V6 and V7 was *a possible target*, but it did not
say it was.  Also, the Speach and Vision PDP-11/40e based systems ran a
very hacked v6 (which a special C compiler that supported CMU's csv/cret
instructions in the microcode), which would have been the target systems.
[1]

To my knowledge/memory, the CMU Algol68 compiler never ran anywhere but
Hydra (and also used custom microcode).  IIRC there was some talk to move
it to *OS (Star OS for CM*)  I've sent a note to dvk to see if he remembers
it otherwise. I also ask Liebensperger what he remembers, he was hacking on
*OS in those days.  Again, IIRC Prof. Peter Hibbard was the mastermind
behind the CMU Algol68 system.  He was a Brit from Cambridge (and taught
the parallel computing course which I took from him at the time).

FWIW: I also don't think the CMU Algol68 compiler was ever completely
self-hosting, and like BLISS, required the PDP-10 to support it.  As to why
it was not moved to the Vax, I was leaving/had left by that time, but I
suspect the students involved graduated and by then the Perq's had become
the hot machine for language types and ADA would start being what the gvt
would give research $s too.


>
>
> ...
>
> But look! The very first line of that file! It is a single # sitting all
> by itself.  Why? you ask. Well this is a hold over from when the C
> preprocessor was new. C orginally did not have it and was added later.
> PL/I had a %INCLUDE so Ritchie eventaully made a #include -- but pre 7th
> Edition the C preprocessor would not be inkoved unless the very first
> character of the C source file was an #
>
That was true of V7 and Typesetter C too.  It was a separate program (
/lib/cpp) that the cc command called if needed.



> Since v7 the preprocessor always run on it. The first C preprocessor was
> Ritchie's work with no nested includes and no macros. v7's was by John
> Reiser which added those parts.
>
Right, this is what I was referring too last night in reference to Sean
comments.  As I said, the /bin/cc command was a shell script and it peaked
at the first character to see if it was #.   I still find myself starting
all C programs with a # on a line by itself ;-)

Note that the Ritchie cpp was influenced by Brian's Ratfor work, so using #
is not surprising.

This leads to a question/thought for this group, although I think needs to
move to COFF (which I have CC'ed for follow up).

I have often contended, that one of the reasons why C, Fortran, and PL/1
were so popular as commercial production languages were because they could
be preprocessed.  For a commercial place where lots of different targets is
possible, that was hugely important.  Pascal, for instance, has semantics
that makes writing a preprocessor like cpp or Ratfor difficult (which was
one of the things Brian talks about in his "*Why Pascal is not my favorite
Programming Language <http://www.lysator.liu.se/c/bwk-on-pascal.html>*"
paper). [2]

So, if you went to commercial ISV's and looked at what they wrote in.   It
was usually some sort of preprocessed language.   Some used Ratfor like a
number of commercial HPC apps vendors, Tektronix wrote PLOT10 in MORTRAN.
 I believe it was Morgan-Stanley had a front-end for PL/1, which I can not
recall the name.  But you get the point ... if you had to target different
runtime environments, it was best for your base code to not be specific.

However ... as C became the system programming language, the preprocessor
was important.  In fact, it even gave birth the other tools like autoconfig
to help control them.  Simply, the idiom:
#ifdef SYSTEMX
#define SOME_VAR (1)
... do something specific
#endif /* SYSTEMX */

While loathsome to read, it actually worked well in practice.

That fact is I hate the preprocessor in many ways but love it for what it
for the freedom it actually gave us to move code.  Having programmed since
the 1960s, I remember how hard it was to move things, even if the language
was the same.

Today, modern languages try to forego the preprocessor.   C++'s solution is
to throw the kitchen sink into the language and have 'frameworks', none of
which work together.   Java's and its family tries to control it with the
JVM.  Go is a little too new to see if its going to work (I don't see a lot
of production ISV code in it yet).

Note: A difference between then and now, is 1) we have few target
architectures and 2) we have fewer target operating environments, 3) ISV
don't like multiple different versions of their SW, they much prefer very
few for maintenance reasons so they like # 1 and #2 [i.e. Cole's law of
economics in operation here].

So ... my question, particularly for those like Doug who have programmed
longer and at least as long as I, what do you think?   You lived the same
time I did and know the difficulties we faced.   Is the loss of a
preprocessor good or bad?

Clem

[1] Historical footnote about CMU.   I was the person that brought V7 into
CMU and I never updated the Speach or Vision systems and I don't think
anyone did after I left.  We ran a CMU V7 variant mostly on the 11/34s (and
later on a couple of 11/44s I believe) that had started to pop up.
Although later if it was a DEC system, CS was moving to Vaxen when they
could get the $s (but the Alto's and Perq's had become popular with the CMU
SPICE proposal).  Departments like bio-engineering, mech ee, ran the
cheaper systems on-site and then networked over the Computer Center's Vaxen
and PDP-20's when they needed address space).

[2] Note: Knuth wrote "Web" to handle a number of the issues, Kernighan
talks about - but he had to use an extended Pascal superset and his program
was notable for not being portable (he wrote for it for the PDP-10
Pascal).  [BTW: Ward Cunningham, TW Cook and I once counted over 8
different 'Tek Pascal' variants and 14 different 'HP Basics'].

[-- Attachment #2: Type: text/html, Size: 13868 bytes --]

             reply	other threads:[~2020-01-08 16:04 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-08 16:02 Clem Cole [this message]
2020-01-08 22:25 ` Dr Iain Maoileoin

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=CAC20D2Pd+gEu8AmsAjJ5vxT+GGfU8PyRXRD7Aux0v2-VUN0N8A@mail.gmail.com \
    --to=clemc@ccc.com \
    --cc=coff@tuhs.org \
    --cc=tuhs@cuzuco.com \
    --cc=tuhs@minnie.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).