Path: utzoo!attcan!uunet!cs.utexas.edu!usc!snorkelwacker!bu.edu!xylogics!transfer!crackers!m2c!umvlsi!dime!dime.cs.umass.edu!moss From: moss@cs.umass.edu (Eliot Moss) Newsgroups: comp.lang.modula2 Subject: Re: FOR loops Message-ID: Date: 6 Jul 90 21:35:46 GMT References: <26730@netnews.upenn.edu> Sender: news@dime.cs.umass.edu Reply-To: moss@cs.umass.edu Organization: Dept of Comp and Info Sci, Univ of Mass (Amherst) Lines: 29 In-reply-to: touch@dsl.cis.upenn.edu's message of 5 Jul 90 16:14:21 GMT The type of "id" in the Modula-3 loop FOR id := first TO last BY step DO S END is the common basetype of "first" and "last". This will be either INTEGER or some enumeration type; it will never be a subrange, though if first and last are compile-time known then the compiler can clearly take advantage of that in doing array bounds checks, assignments to variables having subrange types, etc. The index variable "id" may not be assigned within the loop or passed as a VAR parameter; technically, it is called "readonly". Joe Touch is right that Modula-3 is not a pure superset of Modula-2. Personally, I consider it an improvement over Pascal and Modula-2, because of its addition of garbage collection, objects with single inheritance, exceptions and handlers, and true concurrent threads; it also deleted some items that I feel are needlessly complex. Not everyone agrees with this view; some feel that Oberon is more attractive because it is smaller. That is, ignoring the addition of objects/extensions, Modula-3 looks more like a superset of Modula-2 and Oberon looks more like a subset. Each to their own, but I think garbage collection and exceptions are definite wins in developing quality software. Eliot -- J. Eliot B. Moss, Assistant Professor Department of Computer and Information Science Lederle Graduate Research Center University of Massachusetts Amherst, MA 01003 (413) 545-4206; Moss@cs.umass.edu