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 00:45:17 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!t-online.de!newsfeed.r-kom.de!news-fra.pop.de!schlund.de!news.online.de!not-for-mail From: "Dr. Michael Paus" Newsgroups: comp.lang.ada Subject: Re: Refactoring and Ada Date: Thu, 07 Feb 2002 09:45:12 +0100 Organization: =?iso-8859-1?Q?Ingenieurb=FCro?= Dr. Paus Message-ID: <3C623E98.646B7C0E@ib-paus.com> References: <3C5AB0B7.9D75D49A@grammatech.com> <3C5E0ED6.E2D52BD3@adaworks.com> <5ee5b646.0202040959.37f71ade@posting.google.com> NNTP-Posting-Host: p508305f9.dip0.t-ipconnect.de Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------79FDC7FEB1967A010D7A14A5" X-Trace: news.online.de 1013071515 19676 80.131.5.249 (7 Feb 2002 08:45:15 GMT) X-Complaints-To: abuse@online.de NNTP-Posting-Date: 7 Feb 2002 08:45:15 GMT X-Mailer: Mozilla 4.75 [de]C-CCK-MCD DT (Win98; U) X-Accept-Language: de Xref: archiver1.google.com comp.lang.ada:19693 Date: 2002-02-07T08:45:15+00:00 List-Id: Dies ist eine mehrteilige Nachricht im MIME-Format. --------------79FDC7FEB1967A010D7A14A5 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit 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. 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. Michael --------------79FDC7FEB1967A010D7A14A5 Content-Type: text/x-vcard; charset=us-ascii; name="paus.vcf" Content-Transfer-Encoding: 7bit Content-Description: Visitenkarte f�r Dr. Michael Paus Content-Disposition: attachment; filename="paus.vcf" begin:vcard n:Paus;Michael tel;cell:0177-2238312 tel;fax:+49-(0)711-765-4095 tel;home:+49-(0)711-765-1493 tel;work:+49-(0)711-765-4094 x-mozilla-html:FALSE url:www.ib-paus.com org:Ingenieurb�ro Dr. Paus adr:;;Sch�naicher Str. 3;Stuttgart;;70597;Germany version:2.1 email;internet:paus@ib-paus.com fn:Dr. Michael Paus end:vcard --------------79FDC7FEB1967A010D7A14A5--