Article View: comp.lang.modula2
Article #4207Re: The semantics of the for-loop
From: Robert Firth
Date: Mon, 18 Apr 1988 14:28
Date: Mon, 18 Apr 1988 14:28
23 lines
1316 bytes
1316 bytes
In article <2455@pasteur.Berkeley.Edu> seitz@cory.Berkeley.EDU.UUCP (Matthew Eric Seitz) writes: ]_Programming_In_Modula-2_ essentially defines the for statement as the following ]equivalency ] ]"FOR" ident ":=" expression1 "TO" expression2 [ "BY" ConstExpression ] "DO" ] StatementSequence ]"END" ]is equivalent to ] ]ident ":=" expression1; ]"WHILE" ident "<=" expression2 "DO" ] StatementSequence ] [ident ":=" ident "+" ConstExpression (* if "BY" clause used *) | ] ident ":=" ident "+ 1" (* if "BY" clause not used *) ]";" ]"END" ](* ident := undefined *) It does. And thereby perpetuates the design or implementation error that has cursed FOR-loops since the days of Algol-60: a loop set to end on the largest value of the associated type will fail. This is 1988. Let's at least put THAT right!
Technical Details
Message-ID:
<5099@aw.sei.cmu.edu>Path:
arc1-ca.pugleaf.net!utzoo!mnetor!uunet!husc6!mailrus!rutgers!rochester!pt.cs.cmu.edu!sei!sei.cmu.edu!firthReferences:
<5571@uwmcsd1.UUCP> <2455@pasteur.Berkeley.Edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!mnetor!uunet!husc6!mailrus!rutgers!rochester!pt.cs.cmu.edu!sei!sei.cmu.edu!firth From: firth@sei.cmu.edu (Robert Firth) Newsgroups: comp.lang.modula2 Subject: Re: The semantics of the for-loop Message-ID: <5099@aw.sei.cmu.edu> Date: 18 Apr 88 14:28:18 GMT References: <5571@uwmcsd1.UUCP> <2455@pasteur.Berkeley.Edu> Sender: netnews@sei.cmu.edu Reply-To: firth@bd.sei.cmu.edu.UUCP (Robert Firth) Organization: Carnegie-Mellon University, SEI, Pgh, Pa Lines: 23