From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=BAYES_00,INVALID_DATE autolearn=no autolearn_force=no version=3.4.4 Path: utzoo!attcan!uunet!lll-winken!lll-tis!helios.ee.lbl.gov!pasteur!ucbvax!SEI.CMU.EDU!John.Goodenough From: John.Goodenough@SEI.CMU.EDU Newsgroups: comp.lang.ada Subject: Re: FOR Iteration Scheme Message-ID: <8807191352.AA07439@cs.sei.cmu.edu> Date: 19 Jul 88 13:52:08 GMT Sender: daemon@ucbvax.BERKELEY.EDU Organization: The Internet List-Id: Such code fragments never seem to be completely equivalent. Your structure is not equivalent for expanded names, e.g., PROC.LOOP_NAME.I, won't be possible because you've introduced an extra level of declare block. In addition, language commentary AI-00006 says that the subtype of the loop parameter is determined by the discrete range of the loop. "In particular, if the discrete range is static, the loop parameter has a static subtype". This affects the legality of case statements: for J in 1..2 loop case J is when 1 => ... ; when 2 => ...; end case; No other choices are allowed or required. Also, your equivalence should emphasize that the loop parameter is defined by a base type: type T is range 0..255; for I in T'BASE'FIRST..T'PRED(T'FIRST) loop -- no exception and no positive values! So, your equivalence should be: DECLARE : CONSTANT := E1; : := ; : CONSTANT := E2; BEGIN IF <= THEN LOOP DECLARE I : CONSTANT RANGE .. := ; BEGIN END; EXIT WHEN = ; := 'SUCC(); END LOOP; END IF; END; The initialization of I with ensures that I cannot be used in a static expression, since it is not a static constant. Having had bad luck with trying to define such equivalences, it wouldn't surprise me if there is something else wrong with the above equivalence (apart from the expanded name problem). Any such problem will almost certainly have to do with interactions with other rules in the language, and not the semantic behavior of the loop. John B. Goodenough (Goodenough@sei.cmu.edu) Software Engineering Institute Pittsburgh, PA 15213 412-268-6391