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=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,2586a992fd399bf8 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII Path: g2news2.google.com!postnews.google.com!r4g2000vbq.googlegroups.com!not-for-mail From: Hacid Newsgroups: comp.lang.ada Subject: Re: limited /non-limited tagged type Date: Fri, 4 Mar 2011 13:55:26 -0800 (PST) Organization: http://groups.google.com Message-ID: <9e7a23dd-883c-46fa-88a4-b0ce9aab529d@r4g2000vbq.googlegroups.com> References: <40bfb845-7868-4536-886b-496e8dc82cb4@hd10g2000vbb.googlegroups.com> <4d714736$0$6979$9b4e6d93@newsspool4.arcor-online.net> NNTP-Posting-Host: 62.35.74.134 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1299275726 21899 127.0.0.1 (4 Mar 2011 21:55:26 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Fri, 4 Mar 2011 21:55:26 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: r4g2000vbq.googlegroups.com; posting-host=62.35.74.134; posting-account=WWXKmwoAAABMGIRzC01nO809MBj4MWaf User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux x86_64; fr; rv:1.9.2.14) Gecko/20110221 Ubuntu/10.10 (maverick) Firefox/3.6.14,gzip(gfe) Xref: g2news2.google.com comp.lang.ada:18816 Date: 2011-03-04T13:55:26-08:00 List-Id: On 4 mar, 21:10, Georg Bauhaus wrote: > On 3/4/11 7:56 PM, Hacid wrote: > > > I understand why I can't define my type limited in the public part and > > not limited in the private part. But is there a way to do what I > > want ? > > > Something like : > > > package Foo is > > > =A0 =A0 type Object is tagged private; > > > =A0 =A0 function ":=3D" (Left : out Object,; Right : in Object) is abst= ract; > > -- I know this looks strange > > > end Foo; > > Maybe something along these lines? > > package Foo_3 is > > =A0 =A0 =A0type Object is tagged limited private; > > private > > =A0 =A0 =A0type Wrapped is record > =A0 =A0 =A0 =A0 =A0null; =A0-- ... > =A0 =A0 =A0end record; > > =A0 =A0 =A0procedure Copy_Constructor > =A0 =A0 =A0 =A0 =A0(Source : =A0in Object; > =A0 =A0 =A0 =A0 =A0 Target : out Object ); > > =A0 =A0 =A0type Object is tagged limited > =A0 =A0 =A0 =A0 =A0record > =A0 =A0 =A0 =A0 =A0 =A0 =A0Data : Wrapped; > =A0 =A0 =A0 =A0 =A0end record; > > end Foo_3; > > package body Foo_3 is > > =A0 =A0 =A0procedure Copy_Constructor > =A0 =A0 =A0 =A0 =A0(Source : =A0in Object; > =A0 =A0 =A0 =A0 =A0 Target : out Object ) > =A0 =A0 =A0is > =A0 =A0 =A0begin > =A0 =A0 =A0 =A0 =A0Target.Data :=3D Source.Data; > =A0 =A0 =A0end Copy_Constructor; > > end Foo_3; This solution works but if I extend my package with some addons, I am blocked : generic type Element is new Object with private; package Foo_3.Pools is type Pool is limited private; -- Some services procedure Copy (From : in Pool; To : out Pool); private type Pool is array (1 .. 1_000) of Element; end Foo_3.Pools; -- package body Foo_3.Pools is procedure Copy (From : in Pool; To : out Pool) is begin for I in To'Range loop Copy (From =3D> From (I), To =3D> To (I)); -- This call copy just a part of Element !!! end loop; end Copy; end Foo_3.Pools; Do you see how to resolve this second problem ? Thanks.