Path: utzoo!mnetor!uunet!lll-winken!lll-lcc!ames!pasteur!ucbvax!durham.ac.UK!Barry_Cornelius From: Barry_Cornelius@durham.ac.UK Newsgroups: comp.lang.modula2 Subject: type of limit expressions of FOR loops Message-ID: Date: 12 Apr 88 07:56:11 GMT Sender: daemon@ucbvax.BERKELEY.EDU Reply-To: Info-Modula2 Distribution List Organization: The Internet Lines: 37 Harvard Townsend recently communicated about the types of the expressions used in a FOR statement. Suppose that we are dealing with the FOR statement: FOR v := A TO B BY C DO SS END The original definition of Modula-2 (see, for example, page 154 of the 2nd edition of "Programming in Modula-2" (PIM)) states: "A and B must be assignment compatible with v". However, it was pointed out that the comparison of the control variable and the final value is difficult to implement when one is of type INTEGER and the other is of type CARDINAL. Hence, in the 3rd edition of PIM (page 158), Wirth has: "A and B must be compatible with v". Thus, according to this definition, the mixing of INTEGER and CARDINAL is not allowed. Subsequently, it has been argued that this change need only have been made for the final value, i.e., "A must be assignment compatible and B must be compatible with v". Currently, the standardisation groups have a position which agrees with the 3rd edition of PIM. == Barry Cornelius == Address: Computer Science Group, School of Engineering and Applied Science, University of Durham, Durham, DH1 3LE, England Telephone: My office: Durham (091 or +44 91) 374 2638 Secretary: Durham (091 or +44 91) 374 2630 Fax: Durham (091 or +44 91) 374 3740 Electronic Mail Addresses: JANET: Barry_Cornelius@uk.ac.dur.mts Internet: Barry_Cornelius%mts.dur.ac.uk@cunyvm.cuny.edu UUCP: ...ukc!cs.nott.ac.uk!bjc BITNET/EARN: Barry_Cornelius%DUR.MTS@AC.UK