The Unix Heritage Society mailing list
 help / color / mirror / Atom feed
From: "Steve Johnson" <scj@yaccman.com>
To: "Larry McVoy" <lm@mcvoy.com>, "Steve Johnson" <scj@yaccman.com>
Cc: The Eunuchs Hysterical Society <tuhs@tuhs.org>
Subject: Re: [TUHS] Archaic yacc C grammar
Date: Sat, 03 Nov 2018 15:14:08 -0700	[thread overview]
Message-ID: <135f4f9d6aa38aac485afb158ec1decd27922e67@webmail.yaccman.com> (raw)
In-Reply-To: <20181031005800.GA5670@mcvoy.com>

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



    ----- Original Message -----
    From:"Larry McVoy" <lm@mcvoy.com>

    ...
     I get that it doesn't scale but man, oh man, do I love the
early Unix
    data structures that had one namespace. I kinda wish you hadn't
fixed
    that Steve.

What was the push that made you fix it?

It came from Dennis, so I can't say why he decided to change it.  The
argument for it is that many structures would have similar names and
similar functions, such as "next" and "prev" in linked lists.  
Adding a new linked list action could be done much more easily by
copying the code and changing the declaration, instead of having to
change ab_next into cd_next, and then dealing with the inevitable
typos that would sneak a use of ab_next into code for cd.

Just to clarify, from the beginning I considered C to be Dennis'
language.  I would make suggestions, and sometimes he adopted them
(I'm responsible for ^ as the exclusive OR, for example).  In one
case, with casts, we were porting Unix to the 32-bit Interdata and
desparately needed a cast operator, but couldn't find a syntax that we
liked that was general enough to handle casts to, for example,
structure pointers or function pointers.  Matters were approaching a
crisis, and one evening I played with the yacc grammar and worked out
the strengths and weaknesses of the top three candidates.  I
suggested the one that I felt was best, and that was what was adopted.
  The simple rule was that you formed a cast by taking a declaration
of what you wanted the result to be, remove the variable being
declared, and enclose the rest in parens.  I had implemented it and
saw that it worked (because the port was based on PCC, there wasn't
nearly the pressure to change the PDP-11 compiler).   The fact that
we could explain the syntax in one sentence led us to feel like it
would be reasonable.   The problem, of course, is that we didn't put
anything back where the variable had been, so when you encounter a
nontrivial cast you have to enumerate all the possible places a
variable might be and determine which one is syntactically correst
while your brain turns to mush... 

Steve



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

  parent reply	other threads:[~2018-11-03 23:08 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-28 21:34 Lars Brinkhoff
2018-10-29  3:00 ` Steve Johnson
2018-10-29  7:31   ` Lars Brinkhoff
2018-10-29 17:52     ` Steve Johnson
2018-10-29 18:37       ` Warner Losh
2018-10-30  8:16         ` Lars Brinkhoff
2018-11-03 21:50           ` Steve Johnson
2018-10-29 19:02       ` David
2018-10-30 22:01         ` Steve Johnson
2018-10-31  0:58           ` Larry McVoy
2018-10-31 13:49             ` Clem Cole
2018-11-03 22:14             ` Steve Johnson [this message]
2018-10-31  6:09           ` Lars Brinkhoff
2018-10-31 15:39 Noel Chiappa

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=135f4f9d6aa38aac485afb158ec1decd27922e67@webmail.yaccman.com \
    --to=scj@yaccman.com \
    --cc=lm@mcvoy.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).