🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: mod.computers.apollo
Article #228

Pascal "problem"

#228
From: Wilcox
Date: Tue, 05 Aug 1986 15:39
33 lines
2106 bytes
A recent message noted a "problem" discovered with Pascal.  it has to do
with the form and function of the IF - THEN statement.  The given
statement had the form:

IF ((p <> NIL) AND (link[p^.lp] = 0)) THEN ...

where p <> NIL is the guard to insure the p^.lp reference does not blow
up.  The technique is commonly known as "short-circuiting" and Pascal
has never had it, and probably never will.  A number of High level
languages do not allow short-circuiting.  SNOBOL is one language that I
can think of offhand that does allow short-circuiting.  This shortcoming
of Pascal is more of an inconvienience I think, It would certainly cause
innumerable headaches to those in the debugging business.  The solution
of nested IF - THEN statements is one solution, and the other is
(depending on the function of the code) to use the pointer NIL test as
the loop variable.  For example:

    WHILE ( p <> NIL ) DO
     IF link[p^.lp] THEN ...

I really don't believe there is a problem, but rather it's simply a
problem of inadequate documentation.  Apollo Pascal (NON STANDARD!)
allows a civilized version of Short-circuiting...

    IF (p <> NIL) AND THEN (link[p^.lp]) THEN ....  and
    IF (p <> NIL) OR ELSE (link[p^.lp]) THEN ...

Check into the manual.  It depends on standards and portability in
choosing whether to use the apollo version or use the nested if.

Check a couple of language books, Not reference manuals but language
construction/definition books, and the SNOBOL language reference manual
for further info.......
Technical Details
Message-ID: <860805153910.941792@HI-MULTICS.ARPA>
Path: arc1-ca.pugleaf.net!utzoo!mnetor!seismo!lll-crg!nike!ucbcad!ucbvax!HI-MULTICS.ARPA!Wilcox

Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: arc1-ca.pugleaf.net!utzoo!mnetor!seismo!lll-crg!nike!ucbcad!ucbvax!HI-MULTICS.ARPA!Wilcox
From: Wilcox@HI-MULTICS.ARPA
Newsgroups: mod.computers.apollo
Subject: Pascal "problem"
Message-ID: <860805153910.941792@HI-MULTICS.ARPA>
Date: Tue, 5-Aug-86 11:39:00 EDT
Article-I.D.: HI-MULTI.860805153910.941792
Posted: Tue Aug  5 11:39:00 1986
Date-Received: Wed, 6-Aug-86 02:06:07 EDT
Sender: daemon@ucbvax.BERKELEY.EDU
Organization: The ARPA Internet
Lines: 33
Approved: apollo@yale-comix.arpa