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-Thread: 103376,89cb2d7ffc7421c9 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local02.nntp.dca.giganews.com!nntp.megapath.net!news.megapath.net.POSTED!not-for-mail NNTP-Posting-Date: Thu, 07 Sep 2006 21:06:39 -0500 From: "Randy Brukardt" Newsgroups: comp.lang.ada References: Subject: Re: Ripple effect Date: Thu, 7 Sep 2006 21:08:07 -0500 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1807 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1807 Message-ID: <3bCdnYlbgrOyTZ3YnZ2dnUVZ_tadnZ2d@megapath.net> NNTP-Posting-Host: 64.32.209.38 X-Trace: sv3-Kmc2LkFlyRPzXJagAFG1jy2aKNWa3U3kKYxCCIS1e5xyNjpXBWg4BKMek3xoSf8J13TT6OeKD1GDKYV!rFG80pv9Fue1ZFP3LvBuAMhX3bOyb7wdrLGpehzHNKtbgKlSQWsA0upCFx7JMMb4tYVFnSwlIoyR!ewHhFg5xPfoHFw== X-Complaints-To: abuse@megapath.net X-DMCA-Complaints-To: abuse@megapath.net X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.32 Xref: g2news2.google.com comp.lang.ada:6511 Date: 2006-09-07T21:08:07-05:00 List-Id: "Robert A Duff" wrote in message news:wccodtr4jhx.fsf@shell01.TheWorld.com... > "Randy Brukardt" writes: > > > I guess I disagree -- simply knowing about a type doesn't require objects to > > be created. > > True. But if you know about a type, why are you not allowed to create > objects, or parameters, or do anything else that requires its name? Knowing about a type is a completely separate issue from knowing its name. That's required here simply because the syntax of declarations requires giving the name, not because you actually intend to use that name for anything. ... > >... (If the object comes from somewhere else -- a common case, such > > as when an access to it is passed in -- no with is needed). > > I'm not sure I understand. Can you give a realistic example? Well, a relistic example would be large and take a long time to create. What I'm thinking about is cases where you have a private type that is simply passed through a routine to another layer. I find this sort of thing common in some designs (it depends on how the low-level types are encapsulated). So, if you have a routine something like: procedure Foo (Obj : in Something; Other_Data : in Integer) is begin if Other_Data < 0 then X.Flob (Obj); else X.Flub (Obj, Other_Data); end if; end Foo; Assume that the parameters of Flob and Flub are classwide (and Something is tagged). In this case, no other information is needed, and it isn't necessary to "with" the place where X.Flob's parameter is declared, and drag all kinds of stuff you're not going to use into visibility. This is quite common, except that the need to repeat the name of the type in the subprogram declarations often causes an otherwise unnecessary dependency. "Limited with" can break that in some cases. ... > > Huh? I often check for unused with clauses in my programs - by hand, and > > generally not because of compiler warnings (although we get those, too). I > > often try to eliminate things that are used only once. I guess I'd agree > > more if you said "rarely" as opposed to "ever". > > OK, "rarely" then. It's hard to do that sort of thing by hand. > It's not just unused with_clauses that accumulate during maintenance, > but all kinds of other unused things (use clauses, variables, etc). Unused withs are easy to do by hand if you rarely use 'use' clauses: simply use your editor to show all occurrences of the name of the unit. If there is no hit other than the with clause itself, its unused. If there is only a use clause, (and no other uses), I'll comment out the use clause and see what happens in a recompile (and add comments if it turns out to be needed so I don't do it next time). I generally don't bother eliminating other unused things, although the technique is the same. Well, I'll do variables if cut-and-paste operations are potentially creating a lot of them. (Janus/Ada does not have any unused warnings other than for with clauses; it's almost one-pass design makes that very hard). Randy.