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: 103376,c2f62556e56c9683 X-Google-Attributes: gid103376,public From: Robert A Duff Subject: Re: 'with'ing and 'use'ing Date: 2000/02/29 Message-ID: #1/1 X-Deja-AN: 591427870 Sender: bobduff@world.std.com (Robert A Duff) References: Organization: The World Public Access UNIX, Brookline, MA Newsgroups: comp.lang.ada Date: 2000-02-29T00:00:00+00:00 List-Id: rh@signal.dera.gov.uk (Roger Hoyle) writes: > 1) Is this basically a good idea? It seems sensible to me, but then I know > little about Ada. (I'm asking about generally not 'use'ing stuff, not > specifically my current situation) You've just started a language war between the two dialects of Ada -- the use-phobes and the use-philes. ;-) And then there's the folks who advocate renaming all packages as incomprehensible abbreviations, so you can say XQYBC.Grind_Upon_List. ;-) I slightly prefer using use clauses. Of course, you don't have much choice -- the existing code doesn't use use, so presumably the names were chosen with that in mind. > the operators (=,/=,>=,<=) etc for some of the types in the main > package. The only way I seem to be able to get access to these operators > is to 'use' the package. Is this right, or am I missing somehting? This is a trick used in Ada 83 to avoid use-visibility for identifiers, but still allow the operators to be directly visible. (While saying ``Foo.Bar(X, Y)'' might be reasonable, saying ``Foo."+"(X, Y)'' is an abomination.) Yes, you need to say "use Whatever.Ops;" for this trick to work. The trick is no longer needed in Ada 95 -- use "use type" instead. The trick is a little bit dangerous, because the code in the Ops package is so boring that the reader assumes it says the obvious, without reading it carefully. I remember spending some time tracking down a bug caused by saying something like ``function "xor"(...) renames "and";'' -- a cut-and-paste error. - Bob