Computer Old Farts Forum
 help / color / mirror / Atom feed
From: Paul Winalski <paul.winalski@gmail.com>
To: coff@tuhs.org
Subject: [COFF] Re: Of PL/I
Date: Thu, 4 Apr 2024 11:40:50 -0400	[thread overview]
Message-ID: <CABH=_VQUFcZHT_kRXPdwx_WxJ-oaA-XjjqvCPAt_JgTe4VbFkg@mail.gmail.com> (raw)
In-Reply-To: <516a4019-d987-4ca4-ac62-bd6b40841f93@gmail.com>

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

On Wed, Apr 3, 2024 at 11:37 PM Wesley Parish <wobblygong@gmail.com> wrote:

> I learn C by reading Tanenbaum and Comer's OS books, and I cannot
> imagine how putting variable declarations anywhere other than the top of
> the function they belong to, would make sense. Unless they are global,
> in which case they go in a suitably global header file.
>
> That's the way we always handled declarations in every PL/I shop I worked
in.  Local declarations always appeared immediately following the PROCEDURE
or BEGIN statement that starts the scope to which the declaration applies.
PL/I adopted the idea of nested scopes from Algol.  One other programming
convention we used was to keep variable scopes as localized as possible.
Among other things, it makes lifetime analysis easier for the compiler.

Another feature present in PL/I but not in C or most other languages is
nested procedures.  A nested procedure inherits all of the variables
accessible in the scope of the containing procedure in which it's
declared.  Up-level addressing (use of variables declared outside the
nested procedure) is somewhat error prone and less efficient than accessing
data via a parameter.

PL/I also supports recursion, something not provided for in the usual IBM
S/360 ABI calling convention.  A procedure that can be called recursively
must be declared with the RECURSIVE attribute.  Unlike C, in IBM S/360/370
PL/I recursion was disallowed by default.  DEC's ABI for VMS supports
recursion by default and so DEC PL/I dropped the RECURSIVE attribute.

PL/I also supports an extended version of Fortran's computed GOTO via label
variables.  PL/I statements are labeled by name as opposed to Fortran's
statement numbers.  A label variable can be assigned a statement label
value and a GOTO statement using the label variable transfers control to
whichever statement label is held in the label variable.  Label variables
encourage rat's nest programming styles and very much went out of fashion
when structured programming came along.

-Paul W.

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

  reply	other threads:[~2024-04-04 15:41 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-02 15:06 [COFF] " Dave Horsfall
2024-04-02 16:40 ` [COFF] " Clem Cole
2024-04-02 17:01   ` Charles H Sauer (he/him)
2024-04-03 16:18     ` Paul Winalski
2024-04-03 17:30       ` segaloco via COFF
2024-04-03 20:44         ` Paul Winalski
2024-04-04  3:37         ` Wesley Parish
2024-04-04 15:40           ` Paul Winalski [this message]
2024-04-04 22:53           ` Peter Pentchev
2024-04-07 23:10     ` Dave Horsfall
2024-04-07 23:25       ` Charles H Sauer (he/him)
2024-04-09 21:41         ` Stuff Received
2024-04-10  0:50           ` [COFF] SNOBOL, ICEBOL, SPITBOL, et al William H. Mitchell
2024-04-10  1:42             ` [COFF] " Dave Horsfall
2024-04-08  1:13       ` [COFF] Re: Of PL/I Paul Winalski
2024-04-02 19:25   ` Stuff Received
2024-04-02 20:31     ` William H. Mitchell

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=_VQUFcZHT_kRXPdwx_WxJ-oaA-XjjqvCPAt_JgTe4VbFkg@mail.gmail.com' \
    --to=paul.winalski@gmail.com \
    --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).