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,1ed4b5bd91d02f0b X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!postnews.google.com!o1g2000pra.googlegroups.com!not-for-mail From: Adam Beneschan Newsgroups: comp.lang.ada Subject: Re: using an Ada.Container as a private type Date: Fri, 4 Apr 2008 08:57:55 -0700 (PDT) Organization: http://groups.google.com Message-ID: References: <42c84166-c7e4-42e0-b1bf-2104d3bb0cda@e10g2000prf.googlegroups.com> <5c9b6d27-d54a-43ae-aba8-8ef4b522fbc5@e10g2000prf.googlegroups.com> NNTP-Posting-Host: 66.126.103.122 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: posting.google.com 1207324675 28182 127.0.0.1 (4 Apr 2008 15:57:55 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Fri, 4 Apr 2008 15:57:55 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: o1g2000pra.googlegroups.com; posting-host=66.126.103.122; posting-account=duW0ogkAAABjRdnxgLGXDfna0Gc6XqmQ User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.7.12) Gecko/20050922 Fedora/1.7.12-1.3.1,gzip(gfe),gzip(gfe) Xref: g2news1.google.com comp.lang.ada:20803 Date: 2008-04-04T08:57:55-07:00 List-Id: On Apr 4, 1:02 am, Graham wrote: > On Apr 3, 9:41 pm, Maciej Sobczak wrote: > > > > > On 3 Kwi, 17:29, Graham wrote: > > > > package Payment_Stream_Package is new Ada.Containers.Ordered_Maps( > > > Element_Type => Money, > > > Key_Type => Positive ); > > > > type Payment_Stream is new Payment_Stream_Package.Map; > > > Instead of a solution, I have a question: > > > Why do you derive from Map? Which operations of Map do you plan to > > override? > > > Do you ever plan to pass Payment_Stream where > > Payment_Stream_Package.Map'Class is expected? What effect would you > > like to achieved this way? > > > Why derivation and not composition? > > > -- > > Maciej Sobczak *www.msobczak.com*www.inspirel.com > > Good question. The intention was not to derive from Map at all: I > simply wanted to keep the fact that it was implemented as a Map > private. Is there a better way of doing that, or is keeping it private > overdesign? No, that's the sort of thing you're supposed to do. If you had derived it in the visible (public) part, you're telling all users of the package that all the operations available on Payment_Stream_Package.Map are available for a Payment_Stream, and that's apparently not what you want. So doing what you did is the right thing. I suspect Maciej just missed the fact that the derived type declaration was in the private part. -- Adam