Path: utzoo!mnetor!uunet!husc6!mailrus!tut.cis.ohio-state.edu!rutgers!rochester!pt.cs.cmu.edu!sei!sei.cmu.edu!firth From: firth@sei.cmu.edu (Robert Firth) Newsgroups: comp.lang.misc Subject: Block Closure Message-ID: <5100@aw.sei.cmu.edu> Date: 18 Apr 88 14:42:13 GMT References: <2853@enea.se> <2400014@otter.hple.hp.com> <918@rlgvax.UUCP> Sender: netnews@sei.cmu.edu Reply-To: firth@bd.sei.cmu.edu.UUCP (Robert Firth) Organization: Carnegie-Mellon University, SEI, Pgh, Pa Lines: 50 It seems clearly desirable that every control construct be able to contain multiple statements, embedded within clear starting and ending delimiters. The Algol-68 style used the opening delimited written in reverse (if...fi, case...esac, comment..tnemmoc [joke]). The motivation was decent, but the implementation, to put it mildly, was vile. Ada is a little better, with if ... end if, case ... end case, and so on. Unfortunately, it is not consistent. Moreover, because the closing delimiter is two tokens, there is more chance of human error and of bogus syntactic error recovery error. CPL I think came closest to getting it right: every opening delimiter can be given a mnemonic name, called a "tag", and the corresponsing closing delimiter must repeat the tag. For instance: IF p = NIL DO $(NullCase ... ... $)NullCase The one mistake, I think, was to allow one tagged end delimiter to close many open constructs: IF p = NIL THEN $(NullCase IF freespaceptr = NIL THEN $(NewBlock ... ... $)NullCase This is a concession to laziness that loses far more than it gains. Note that this still has the Algol-60 style: the control structure really governs only one statement, so you have to add a pair of delimiters after it. This is probably an obsolete notion. A feasible design might be a combination of CPL tags and Modula syntax, for instance: NullCase: IF p = NIL THEN ... ... END NullCase though I'm unhappy with that layout.