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,8054919d7e55838b X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!postnews.google.com!v46g2000cwv.googlegroups.com!not-for-mail From: "Matthew Heaney" Newsgroups: comp.lang.ada Subject: Re: Q: Hiding the structure of a tagged type using containers Date: 9 May 2006 07:47:10 -0700 Organization: http://groups.google.com Message-ID: <1147186030.145802.222440@v46g2000cwv.googlegroups.com> References: <1147139575.425825.290860@u72g2000cwu.googlegroups.com> NNTP-Posting-Host: 66.162.65.129 Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Trace: posting.google.com 1147186039 14803 127.0.0.1 (9 May 2006 14:47:19 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Tue, 9 May 2006 14:47:19 +0000 (UTC) In-Reply-To: <1147139575.425825.290860@u72g2000cwu.googlegroups.com> User-Agent: G2/0.2 X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322),gzip(gfe),gzip(gfe) Complaints-To: groups-abuse@google.com Injection-Info: v46g2000cwv.googlegroups.com; posting-host=66.162.65.129; posting-account=Zl1UPAwAAADEsUSm1PMMiDjihtBlZUi_ Xref: g2news2.google.com comp.lang.ada:4154 Date: 2006-05-09T07:47:10-07:00 List-Id: brian.b.mcguinness@lmco.com wrote: > I am trying to create a tree of object classes to represent arrays. I > want to hide the internal representation of the arrays in the private > sections of the packages for the tagged types. Yes, that's a good idea. > However, I am having > trouble figuring out how to do this. > I tried this: > > 1 > 6 with Ada.Containers.Vectors; > 7 > 8 package APL.Arrays.Dimensioned is > 9 > 10 type APL_Shape is private; > 11 > 26 private > 27 > 28 package APL_Dimension_List is new Ada.Containers.Vectors ( > 29 Index_Type => Dimension_Index, > 30 Element_Type => Dimension > 31 ); > 32 > 33 type APL_Shape is new APL_Dimension_List.Vector with null record; Why is this a derivation? Just say: type APL_Shape is record V : APL_Dimension_List.Vector; end record; > 35 type APL_Array_Dimensioned is new APL_Array with record > 36 Dimensions : APL_Shape; > 37 end record; > 38 > 39 end APL.Arrays.Dimensioned; > > > Using APL_Dimension_List.Vector might work, but I am trying to > rename this to APL_Shape in order to hide the ".Vector" part > and make the dimension list look like a simple data type. Fine, just implement APL_Shape as a non-tagged record with a vector component.