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,2c6139ce13be9980 X-Google-Attributes: gidfac41,public X-Google-Thread: 1108a1,2c6139ce13be9980 X-Google-Attributes: gid1108a1,public X-Google-Thread: 103376,3d3f20d31be1c33a X-Google-Attributes: gid103376,public X-Google-Thread: f43e6,2c6139ce13be9980 X-Google-Attributes: gidf43e6,public From: Joachim Durchholz Subject: Re: Interface/Implementation (was Re: Design by Contract) Date: 1997/09/06 Message-ID: <3411C49D.5BD03C7B@munich.netsurf.de>#1/1 X-Deja-AN: 270343836 References: <340C85CE.6F42@link.com> X-Priority: 3 (Normal) Newsgroups: comp.object,comp.software-eng,comp.lang.ada,comp.lang.eiffel Date: 1997-09-06T00:00:00+00:00 List-Id: Matthew Heaney wrote: > > >IMO, there's no excuse for imposing dependency-related ordering > >in an age of multi-pass compilation. > > Note that many computer scientists, among them Tony Hoare, believe > that a > measurement of goodness of a language is its ability to be compiled > using a > single pass. Well, dropping names doesn't help me understanding your point. Can you give some arguments why a one-pass-compilation language is superior? > That there is a dependency-related ordering in Ada (both 83 and 95) is > by design; that was the precise intent of Ada's designers. I can see that. > This should > be regarded as a Good Thing, because it makes it easier for the human > reader to apprehend program text. This is a valid point. However, not all definitions are cycle-free in practice. Notable examples are pointers and recursive routines. These are dependencies that originate in run-time usage. In an OO language, inheritance adds a strictly compile-time dependency. (E.g. a class C may contain references to objects of class D where D is some remote descendant of C.) It is impossible to remove all circularities, so the language must not prohibit them (though it is a Good Thing to arrange a program so that most dependencies are one direction). > The same philosophy applies to exits from inside a loop > > loop > > exit when > > end loop; > > Many programmers think that it's better to use a while loop, ie > > while not Done loop > > Done := True; > if not Done then > > end if; > end loop; Unfortunately I cannot totally agree with you here. A while loop has a tremendous advantage: it makes the termination condition stand out clearly. After reading while loop end loop can be sure that does not hold after "end loop". This may be enough that I can read on without further looking at the loop body (at least if I'm only interested in some properties of the code, e.g. the control flow under some specific circumstances). Of course if the termination condition is just "Done" this doesn't help me when reading the code, but such flags aren't too frequent (at least if you tend to avoid them, it's a matter of personal style to some degree). It may be more straightforward to symbolically execute an "exit when"-style loop. But for gathering properties of a piece of code a while loop is often better. Regards, Joachim -- Please don't send unsolicited ads.