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,f24afa16a58c409 X-Google-Attributes: gid103376,public From: "David C. Hoos, Sr." Subject: Re: premature use of private Date: 1999/08/17 Message-ID: #1/1 X-Deja-AN: 513973977 Content-Transfer-Encoding: 7bit References: <37b9ac3d@news1.us.ibm.net> Content-Type: text/plain; charset="iso-8859-1" X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300 X-Trace: typ11.nn.bcandid.com 934929119 216.180.14.180 (Tue, 17 Aug 1999 18:31:59 EDT) MIME-Version: 1.0 NNTP-Posting-Date: Tue, 17 Aug 1999 18:31:59 EDT Newsgroups: comp.lang.ada Date: 1999-08-17T00:00:00+00:00 List-Id: wrote in message news:Lgju3.398$06.54131@typhoon-sf.snfc21.pbi.net... > > package Fruit.Apple_Sets is > > new Fruit_Sets (Apple_Type, Apple_Ptr); > The fruit stand operator wants a pretty display, so he needs > function Prettier_Than(X : Fruit_Type) return Fruit.Apple_Sets.Pile; > function Prettier_Than(X : Fruit_Type) return Fruit.Orange_Sets.Pile; > etc. > for those occasions when he wants to display a nice apple surrounded > by even prettier oranges from his stock, or whatever. Does he need > with Fruit, Fruit.Apple_Sets, Fruit.Orange_Sets; No. mentioning a child pacage in a context clause gives visibility to the child and all of its ancestors. > package Getting_Complicated is > function Prettier_Than(X : Fruit_Type) return Fruit.Apple_Sets.Pile; > function Prettier_Than(X : Fruit_Type) return Fruit.Orange_Sets.Pile; > ... > It seems unreasonable that it should be so much trouble just to > declare a simple *homogenous* array. I understand that the compiler > has a probem with an array when it doesn't yet know the size of its > elements, but here the elements are all pointers, so that isn't > a problem. Have you forgotten that your Set package is more than just a "homogeneous" array of pointers? You've declared an operation Sort_By_Size which implies dereferencing those pointers and performing operations on the object itself.