The Unix Heritage Society mailing list
 help / color / mirror / Atom feed
From: Paul Winalski <paul.winalski@gmail.com>
To: Douglas McIlroy <douglas.mcilroy@dartmouth.edu>
Cc: TUHS main list <tuhs@minnie.tuhs.org>
Subject: Re: [TUHS] PL/I stuff - was: Book Recommendation
Date: Thu, 25 Nov 2021 11:35:13 -0500	[thread overview]
Message-ID: <CABH=_VQL1+WnaR4Dn44o_vOvKLrVonx0POU6g5CG-fVckp6Znw@mail.gmail.com> (raw)
In-Reply-To: <CAKH6PiWUcRErWURZofEOwvnPTJDzwcVeEf41mu4HEe6x9j0qSg@mail.gmail.com>

On 11/24/21, Douglas McIlroy <douglas.mcilroy@dartmouth.edu> wrote:
>> What, if any, features does PL/I have that are not realized in a modern
>> language?
>
> 7. Astonishingly complete set of implicit data conversions. E.g. if X
> is floating-point and S is a string, the assignment X = S works when S
> = "2" and raises an exception (not PL/I terminology) when S =  "A".

This could definitely be a buzz saw without safety shields.  Some of
the implicit conversion rules, particularly those dealing with fixed
point decimal arithmetic of mixed precision, had edge conditions that
yielded non-intuitive results.

I had a bug once that was due to a typo causing an unwanted implicit
conversion.  I had meant to type "IF A ~= B" (I'm using ~ here in
place of the PL/I "not" operator--the EBCDIC angle character), meaning
"IF A is not equal to B".  What I actually typed is "IF A =~ B". (if A
equals not-B).  Both A and B were character strings.  To apply the NOT
operator, B was converted to a bit string with '0' converted to a zero
bit and '1' to a one bit.  The NOT was performed, then the bit string
was converted back to a character string so that it could be compared
to A.  My clue as to the bug was a warning diagnostic from the
compiler:  "data conversion will be done by subroutine call".  This
almost always meant you'd accidentally invoked some kinky implicit
type conversion, as was the case here.

Here are some other PL/I features you don't see in modern languages.
Some of these were present in the early IBM PL/I compilers but dropped
from the ANSI standard:

1. Sterling pictures.  These provided a convenient way to do math on
and to display numbers representing pre-decimal British currency.
They had pounds, shillings, and pence fields.  This feature was
dropped even from the IBM compilers some years after the Commonwealth
nations all went decimal.

2. The DEFAULT statement.  This was Forran's IMPLICIT on steroids.  It
let you say things like "data items with names beginning with A-G are
decimal, I-N are binary, and O-Z are decimal".  There could also be
overlap between DEFAULT declarations.  So in addition to the rule I
just mentioned, you could say "A-J are fixed point and K-Z are
floating point."  With both of these rules in effect, identifier FOO
would be implicitly "fixed decimal", J would be "fixed biary, and KOOL
would be "float binary".

At our PL/I shop we considered DEFAULT to be a toxic language feature
that was banned.  The problem is that in the presence of a complicated
nest of DEFAULTs, when you see the declaration for an identifier it
can be next to impossible to tell what its complete data type actually
is.

3. PL/I declarations cover the entire scope of the innermost BEGIN/END
block that contains them, regardless of where within that block the
declaration occurs.  Thus you can use variables before they are
declared.  This was mildly useful if you were composing a program at
the keypunch.  Some programmers would write down the declarations for
their variables as they punched the cards, then when they came to the
END statement for a block they would punch out the declarations.  At
our shop this, again, was considered a toxic language feature--we
required all declarations to be at the start of their containing
block.

-Paul W.

  reply	other threads:[~2021-11-25 16:37 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-24 23:54 Douglas McIlroy
2021-11-25 16:35 ` Paul Winalski [this message]
2021-11-25 18:15   ` Steve Nickolas
2021-11-26 16:59   ` Paul Winalski
2021-11-26 20:30     ` Tom Ivar Helbekkmo via TUHS
2021-11-26 21:22       ` John Cowan
2021-11-27  0:01         ` George Michaelson
2021-11-27 16:12           ` Paul Winalski
  -- strict thread matches above, loose matches on Subject: below --
2021-11-27 15:25 Noel Chiappa
2021-11-27 15:53 ` Charles H Sauer
2021-11-16 14:57 [TUHS] " Douglas McIlroy
2021-11-23  2:28 ` Mary Ann Horton
2021-11-23 21:54   ` Thomas Paulsen
2021-11-24 15:18     ` Richard Salz
2021-11-24 22:19       ` Charles Anthony
2021-11-24 22:29         ` [TUHS] PL/I stuff - was: " Will Senn
2021-11-24 23:00           ` Rob Pike
2021-11-24 23:13             ` Richard Salz
2021-11-25  1:48           ` Nelson H. F. Beebe
2021-11-25  2:03             ` George Michaelson
2021-11-25 14:47               ` Clem Cole
2021-11-26 22:20                 ` Alan Glasser
2021-11-26 22:33               ` Alan Glasser
2021-11-27  0:23               ` Dennis Boone
2021-11-27  0:30                 ` Larry McVoy
2021-11-27  0:47                   ` Charles H. Sauer
2021-11-27  2:43                     ` Alan Glasser
2021-11-27  0:56                   ` Warner Losh

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='CABH=_VQL1+WnaR4Dn44o_vOvKLrVonx0POU6g5CG-fVckp6Znw@mail.gmail.com' \
    --to=paul.winalski@gmail.com \
    --cc=douglas.mcilroy@dartmouth.edu \
    --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).