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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,4c459ff0adb576bc X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-02-07 05:55:04 PST Path: archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-01!supernews.com!feeder.qis.net!newspeer.monmouth.com!newscon02.news.prodigy.com!newsmst01.news.prodigy.com!prodigy.com!postmaster.news.prodigy.com!newssvr11.news.prodigy.com.POSTED!not-for-mail From: "Pat Rogers" Newsgroups: comp.lang.ada References: <3C5AB0B7.9D75D49A@grammatech.com> <3C5E0ED6.E2D52BD3@adaworks.com> <5ee5b646.0202040959.37f71ade@posting.google.com> <3C623E98.646B7C0E@ib-paus.com> Subject: Re: Refactoring and Ada X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2600.0000 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 Message-ID: NNTP-Posting-Host: 208.191.180.40 X-Complaints-To: abuse@prodigy.net X-Trace: newssvr11.news.prodigy.com 1013090068 ST000 208.191.180.40 (Thu, 07 Feb 2002 08:54:28 EST) NNTP-Posting-Date: Thu, 07 Feb 2002 08:54:28 EST Organization: Prodigy Internet http://www.prodigy.com X-UserInfo1: Q[R_PJONFJVMQVPXJZDBNFXBBZ\LPCXLLBWLOOAFMAVNDQUBLNTC@AWZWDXZXQ[K\FFSKCVM@F_N_DOBWVWG__LG@VVOIPLIGX\\BU_B@\P\PFX\B[APHTWAHDCKJF^NHD[YJAZMCY_CWG[SX\Y]^KC\HSZRWSWKGAY_PC[BQ[BXAS\F\\@DMTLFZFUE@\VL Date: Thu, 07 Feb 2002 13:54:28 GMT Xref: archiver1.google.com comp.lang.ada:19701 Date: 2002-02-07T13:54:28+00:00 List-Id: "Dr. Michael Paus" wrote in message news:3C623E98.646B7C0E@ib-paus.com... > Robert Dewar wrote: > > > By the way, I talked to a never-ever-use-use user of Ada > > the other day who was appalled to discover that even if > > you don't use USE clauses, you can have a case where you > > write > > > > a := f (x); > > > > where there were no other occurrences of f in the same > > source file, no USE clauses, and the textual declaration > > of f was in another unit. > > > > This is of course standard in both Ada 83 and Ada 95 (if > > you don't know how it arises, and always assumed that avoiding use > > clauses guaranteed that this could not happen, > > you have always been fooling yourself :-) > > > > I often find that people think that avoiding use clauses > > avoids this, and requires full qualification. In fact in > > the above example, suppose the only other occurrence of > > f is in package p, then it is the case that trying to > > qualify by writing > > > > a := p.f (x); > > > > is not just unnecessary, but in fact illegal. > > If I understand your example correctly, it reflects a problem > which I recently had to fix in program written by someone else. > We had the requirement not to use use and so the call of f had > to be qualified as in your example above. That's a good example of the effect of blindly following bad rules, since the "don't use use-clauses rule" doesn't even apply here. > The compiler complained > about this of course and can you imagine what the programmer did > in order to fix the problem? The type of x (B_Type) was derived from > some other type (let's say A_Type). So the programmer wrote: > > a := p.f (p.A_Type(x)); > > The compiler was happy and in this particular case the program > even did what it was assumed to do. The hidden bug in this > statement is a maintenance time-bomb which would not have occurred > if use had been used. No, it is not a matter of use clauses, in terms of *language rules* they are not at play here. That is explicitly a call to the parent operation, and it should not have passed the code review. It did not do what it was assumed to do, for that matter -- it called the parent operation, which must have not been overridden since it seemed to do the right thing. They should have written it something like this, to satisfy whomever: package P is type T is range 1 .. 10; procedure Q( This : out T ); end P; with P; procedure R is type T2 is new P.T; X : T2; begin R.Q( X ); -- note the name of the unit enclosing the derivation end R; --- Patrick Rogers Consulting and Training in: http://www.classwide.com Real-Time/OO Languages progers@classwide.com Hard Deadline Schedulability Analysis (281)648-3165 Software Fault Tolerance