🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.modula2
Article #883

Re: FOR loops

#883
From: Eliot Moss
Date: Thu, 05 Jul 1990 13:08
17 lines
1466 bytes
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.
This makes it even more clear that the optimization can be performed and that
the value after the cannot be depended upon. If you need the last value after
the loop, you must explicitly assign it to a variable defined in the broader
scope. This seems to me to be the best way to design a looping construct;
CLU's iterators generalize what you can loop over, but the index variable's
scope is as for Modula-3 and Ada. CLU's usage predates those other languages,
but I am not sure where this style of definition first arose.
--

		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
Technical Details
Message-ID: <MOSS.90Jul5090826@ibis.cs.umass.edu>
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!samsung!usc!snorkelwacker!bu.edu!xylogics!transfer!crackers!m2c!umvlsi!dime!dime.cs.umass.edu!moss
References: <INFO-M2%90070316593556@UCF1VM.BITNET>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!samsung!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: <MOSS.90Jul5090826@ibis.cs.umass.edu>
Date: 5 Jul 90 13:08:26 GMT
References: <INFO-M2%90070316593556@UCF1VM.BITNET>
Sender: news@dime.cs.umass.edu
Reply-To: moss@cs.umass.edu
Organization: Dept of Comp and Info Sci, Univ of Mass (Amherst)
Lines: 17
In-reply-to: ROSS@UCF1VM.BITNET's message of 3 Jul 90 20:54:15 GMT