Path: utzoo!attcan!uunet!cs.utexas.edu!sdd.hp.com!zaphod.mps.ohio-state.edu!unix.cis.pitt.edu!dsinc!netnews.upenn.edu!dsl.cis.upenn.edu!touch From: touch@dsl.cis.upenn.edu (Joe Touch) Newsgroups: comp.lang.modula2 Subject: Re: FOR loops Message-ID: <26730@netnews.upenn.edu> Date: 5 Jul 90 16:14:21 GMT References: Sender: news@netnews.upenn.edu Reply-To: touch@dsl.cis.upenn.edu (Joe Touch) Organization: University of Pennsylvania Lines: 18 In article moss@cs.umass.edu writes: >Just for fun, I note that Modula-3 (and Ada for that matter) make the index >variable of a FOR loop a *new* variable, defined only between the DO and END. Just to note, I asked the people at DEC (who wrote and distributed Modula-3), and Modula-3 is **not** a superset of Modula-2. The two are related, but substantially different. And a question - if the FOR loop variable is defined only within the loop, where is its type defined? For example: FOR i = a TO b statement... is this always OK, provided the compiler can unify the types of a, b, and any use of i inside the statement? if so, the decision of the type correctness of i cannot occur until after the entire loop has been scanned. Joe