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=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fac41,9a0ff0bffdf63657 X-Google-Attributes: gidfac41,public X-Google-Thread: 103376,4b06f8f15f01a568 X-Google-Attributes: gid103376,public X-Google-Thread: 1108a1,9a0ff0bffdf63657 X-Google-Attributes: gid1108a1,public X-Google-Thread: f43e6,9a0ff0bffdf63657 X-Google-Attributes: gidf43e6,public From: claveman@inetworld.net (Charles H. Sampson) Subject: Re: Software landmines (loops) Date: 1998/10/06 Message-ID: <1dghyt5.oik1lzhxzf2N@n207167116176.inetworld.net>#1/1 X-Deja-AN: 398521124 References: <35cb8058.645630787@news.ne.mediaone.net> <902934874.2099.0.nnrp-10.c246a717@news.demon.co.uk> <6r1glm$bvh$1@nnrp1.dejanews.com> <6r9f8h$jtm$1@nnrp1.dejanews.com> <6renh8$ga7$1@nnrp1.dejanews.com> <6rf59b$2ud$1@nnrp1.dejanews.com> <6rfra4$rul$1@nnrp1.dejanews.com> <35DBDD24.D003404D@calfp.co.uk> <6sbuod$fra$1@hirame.wwa.com> <35f51e53.48044143@news.erols.com> <6sdiav$e0g$1@hirame.wwa.com> <6sfcft$70p$1@hirame.wwa.com> <1dg8p3r.vfredh1aou58iN@n207167116191.inetworld.net> <6v2nr9$t8l$1@hirame.wwa.com> <1dgane6.16owv2g7g8ov8N@u2n207167116151.inetworld.net> <1dge7py.7401x8z7ne24N@u2n207167116162.inetworld.net> X-Trace: news2.randori.com 907735490 207.167.116.176 (Tue, 06 Oct 1998 21:44:50 PDT) NNTP-Posting-Date: Tue, 06 Oct 1998 21:44:50 PDT Newsgroups: comp.lang.eiffel,comp.object,comp.software-eng,comp.lang.ada Date: 1998-10-06T00:00:00+00:00 List-Id: Reimer Behrends wrote: > Charles H. Sampson (claveman@inetworld.net) wrote: > > Reimer Behrends wrote: > [Mid-exit loops.] > > > You may notice, however, that the loop _body_ has two different exits > > > for a mid-exit loop. > > > > I don't know about others, but I don't notice any such thing. Here > > is a cut down version of the loop we were discussing. > > > > loop > > > > exit > > > > end loop > > > > Please point out the two exits (neither nor > > has one) or give the definition of that you're using. > > The loop body is of course the following part of the code: > > > exit > > > It has an exit at the "exit" statement, and one at the end of part>, where control flow leaves the body to reenter at the top. And > I'm not kidding you. Try to put the loop body into a procedure of its > own, and this becomes very visible. (Ease of procedural decomposition is > usually one of the benefits of strict single-entry, single-exit > structures.) > O. k., I might grudgingly grant you a half score on that one. You pretty clearly said "loop body", but I was so fixed on "loop" that I didn't notice that you had changed the frame of reference. I think I can be forgiven for my mistake; this whole subthread has been about exits from loops, not exits from loop bodies. Furthermore, it's not clear why that transfer of control is consid- ered an exit from the loop body. Prior to the transfer a statement of the body is executing. After the transfer a statement of the body is executing. Where is the exit part? Then there's the concept of transfer of control itself. I'm sur- prised about that. Is that still taught in CS departments? Certainly I was taught it (I'm a VERY old programmer) and I still have to think about it in the rare cases when I'm mucking about among the 0s and 1s, but when I'm working in as good a high-level language as Ada I don't think in terms of control at all any more. For example, a loop body for me is simply a sequence of statement that is repeatedly executed until some condition arises. (In case anyone wants to say, "Well, and exit statement contradicts that concept," an implicit effect of the execution of an exit statement is to abort the execution of the rest of the loop body.) For an if-then-else, there are two sequences of statements, of which one will execute depending on the value of a Boolean expression; I don't think of transferring control from the evaluation code to the else part if the expression evaluates to false. I don't even think in terms of transfer of control when an exception is raised; raising an exception simply causes a certain dynamically determined exception handler to exe- cute. Without thinking about it too hard, I'll grant your claim about ease of decomposition. I don't want to think too hard about it because I have the strong impression that this is another "who cares?" issue. In my entire career I have rarely written the following construct: end loop Actually, I can't remember ever doing it, but I assume that I must have at least a few times. Charlie -- To get my correct email address, replace the "claveman" by "csampson" in my fake (anti-spam) address.