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,bb06c19745c6aacb X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!feeder.news-service.com!novso.com!nerim.net!feeder1-2.proxad.net!proxad.net!feeder2-2.proxad.net!newsfeed.arcor.de!newsspool1.arcor-online.net!news.arcor.de.POSTED!not-for-mail Date: Thu, 09 Jun 2011 22:41:57 +0200 From: Georg Bauhaus User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.17) Gecko/20110414 Thunderbird/3.1.10 MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Use of abstract tagged types without access types -- again and complete References: <53347692-e182-4f2f-8598-453af64e16fc@w36g2000vbi.googlegroups.com> In-Reply-To: <53347692-e182-4f2f-8598-453af64e16fc@w36g2000vbi.googlegroups.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Message-ID: <4df13015$0$7616$9b4e6d93@newsspool1.arcor-online.net> Organization: Arcor NNTP-Posting-Date: 09 Jun 2011 22:41:58 CEST NNTP-Posting-Host: 20d8adee.newsspool1.arcor-online.net X-Trace: DXC=dPTU\\gX4oQ\PS5Xo=M[RVic==]BZ:af^4Fo<]lROoRQ<`=YMgDjhgRlY\DnWb[:ERPCY\c7>ejVXVMg7=4SF1GZAl1gYlQgLY] X-Complaints-To: usenet-abuse@arcor.de Xref: g2news1.google.com comp.lang.ada:19721 Date: 2011-06-09T22:41:58+02:00 List-Id: On 6/9/11 7:50 PM, Prof. Dr. Carl Weierstrass wrote: > This doesn't work, because: > class-wide subtype with unknown discriminants in component declaration > > Of course I could use an access type to avoid the error but is there a > way to > do something like this without access types. You can defer access types if this helps. An outline is below. Maybe the SPARK people know how one may add polymorphic types without pointers, or not. with Test; package Test_Test is generic type Expanded_Child_Type is new Test.Child_Type with private; package Child_Pick is type Some_Parent is new Test.Parent_Type with record Child : Expanded_Child_Type; end record; end Child_Pick; package Pick_1 is new Child_Pick (Test.Child_Type_1); package Pick_N is new Child_Pick (Test.Child_Type_N); end Test_Test; with Test, Test_Test; procedure Test_Test_Test is type Ref is access Test.Parent_Type'Class; X : Ref := new Test_Test.Pick_1.Some_Parent; Y : Ref := new Test_Test.Pick_N.Some_Parent; begin X := Y; end Test_Test_Test;