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.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,2a687662f09731bb X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!t-online.de!news.karotte.org!news2.arglkargh.de!noris.net!newsfeed.arcor.de!news.arcor.de!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: Don't use the "use" clause Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.14.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Reply-To: mailbox@dmitry-kazakov.de Organization: cbb software GmbH References: <1132227919.9036.51.camel@sonnenregen> <1132233886.11218.11.camel@sonnenregen> Date: Sat, 19 Nov 2005 22:48:39 +0100 Message-ID: <1ef4kvy6kdkwz.oqmb8acj5joo.dlg@40tude.net> NNTP-Posting-Date: 19 Nov 2005 22:48:40 MET NNTP-Posting-Host: 3f64fdaf.newsread2.arcor-online.net X-Trace: DXC=IHRf1[ On Sat, 19 Nov 2005 20:28:25 GMT, Anonymous Coward wrote: > In article , Stephen Leake wrote: >> >> You introduced a name collision by the 'use' clause; that can always >> cause name collisions. The proper solution in that case is to use >> the qualified name. > > I agree. I personally take it an extreme step further, and never use > use clauses anywhere. They shouldn't even be in the language. Every > Ada project I've worked on that had a coding standard banned the use > clause, and rightly so. No, name collisions better be prevented by making "use" illegal when it hides anything. BTW, what about banning implicit "use" of "Standard"? Care to write an AI to make Integer, "+", "-" etc invisible? (:-)) > I don't only oppose it because of the ambiguity, but even when there > is no ambiguity, it's a severe inconvenience to have to grep a large > tree to hunt down a declaration. IDE should have "go to declaration" button. > Then to possibly get multiple hits > and have to compare two lists of packages to discover which hit is the > correct one. By the time you make it to the declaration you're > looking for, you've forgotten why you need to look at it :) It is no matter "where", "what" does matter. If you need to frequently browse sources to determine "what", then the program is poorly designed. > Clearly the typing time saved by the use clause cannot possibly offset > the time lost on all the resulting code searches. What about the time spent on reading something like A.B.C.D.E.F.G.H? If I were a "use"-hater I would propose a reverse notation for fully qualified names: H of G of F of E of D of C of B of A (at least for those who reads programs from left to right it would be a great help! (:-)) -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de