🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.modula2
Article #885

Re: FOR loops

#885
From: Joe Touch
Date: Thu, 05 Jul 1990 16:14
18 lines
1333 bytes
In article <MOSS.90Jul5090826@ibis.cs.umass.edu> 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
Technical Details
Message-ID: <26730@netnews.upenn.edu>
Path: arc1-ca.pugleaf.net!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
References: <INFO-M2%90070316593556@UCF1VM.BITNET> <MOSS.90Jul5090826@ibis.cs.umass.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!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: <INFO-M2%90070316593556@UCF1VM.BITNET> <MOSS.90Jul5090826@ibis.cs.umass.edu>
Sender: news@netnews.upenn.edu
Reply-To: touch@dsl.cis.upenn.edu (Joe Touch)
Organization: University of Pennsylvania
Lines: 18