Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!samsung!uunet!mcsun!hp4nl!ruuinf!cs.ruu.nl From: piet@cs.ruu.nl (Piet van Oostrum) Newsgroups: comp.lang.modula2 Subject: Re: BY expression Message-ID: <2378@ruuinf.cs.ruu.nl> Date: 1 Feb 90 22:54:25 GMT References: Sender: news@ruuinf.cs.ruu.nl Reply-To: piet@cs.ruu.nl (Piet van Oostrum) Organization: Dept of Computer Science, Utrecht University, The Netherlands Lines: 15 In-reply-to: BARRY@LAUCOSC.LAURENTIAN.CA (Barry Adams) In article , BARRY@LAUCOSC (Barry Adams) writes: `Does anyone know why the BY expression in a FOR loop must be `a constant expression? Is there some semantic reason? If you want an answer to a question of the kind: Why is this or that not possible in Pascal or Modula-2, the answer is usually: Because it is easier to compile. If the BY expression is allowed to be a variable expression, it could be either positive or negative at run time. So the compiler must insert extra code to decide at runtime whether the loop will be ascending or descending. -- Piet* van Oostrum, Dept of Computer Science, Utrecht University, Padualaan 14, P.O. Box 80.089, 3508 TB Utrecht, The Netherlands. Telephone: +31-30-531806 Uucp: uunet!mcsun!hp4nl!ruuinf!piet Telefax: +31-30-513791 Internet: piet@cs.ruu.nl (*`Pete')