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.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,dbbbb21ed7f581b X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII Path: g2news1.google.com!news4.google.com!proxad.net!feeder1-2.proxad.net!194.25.134.126.MISMATCH!newsfeed01.sul.t-online.de!t-online.de!newsfeed.arcor.de!newsspool1.arcor-online.net!news.arcor.de.POSTED!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: Operation can be dispatching in only one type Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.15.1 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8bit Reply-To: mailbox@dmitry-kazakov.de Organization: cbb software GmbH References: <025105f2-5571-400e-a66f-ef1c3dc9ef32@g27g2000yqn.googlegroups.com> <691d6892-bc5e-4d81-8025-c36556bf2593@13g2000prl.googlegroups.com> <1h9hilcg5i6il.12edpgu4szw1h.dlg@40tude.net> <1wtsriaxu0s4s$.ikwnnz5teukp$.dlg@40tude.net> <1iipp3bn16fe2.yqa1gz1ru17a$.dlg@40tude.net> <18wh86jvjvoe0.cofxcc8udm6q$.dlg@40tude.net> <53a35ed9-88ac-43dc-b2a2-8d6880802328@j19g2000yqk.googlegroups.com> <4b091fb9$0$6567$9b4e6d93@newsspool4.arcor-online.net> <1w0q3zxzw79pt$.5z0juiky7kfd$.dlg@40tude.net> <0f177771-381e-493b-92bb-28419dfbe4e6@k19g2000yqc.googlegroups.com> <1nbcfi99y0fkg.1h5ox2lj73okx$.dlg@40tude.net> <59acf311-3a4a-4eda-95a3-22272842305e@m16g2000yqc.googlegroups.com> Date: Sun, 22 Nov 2009 19:28:32 +0100 Message-ID: NNTP-Posting-Date: 22 Nov 2009 19:28:30 CET NNTP-Posting-Host: 70020348.newsspool1.arcor-online.net X-Trace: DXC=LT32XV7a8LXHigV@eW57PQic==]BZ:af^4Fo<]lROoRQ<`=YMgDjhgR^WGQCe:M8X[[6LHn;2LCV^[ On Sun, 22 Nov 2009 10:03:22 -0800 (PST), xorque wrote: > On Nov 22, 5:41�pm, "Dmitry A. Kazakov" > wrote: >> On Sun, 22 Nov 2009 08:52:05 -0800 (PST), xorque wrote: >> >>> I have to admit to not understanding that error. >> >> And I don't understand your design. If Archive is a Stream derive then it >> from Root_Stream_Type. If it deals with a stream then pass >> Root_Stream_Type'Class to the operations that need it. > > The design is both irrelevant and obsolete. I'm just trying to find out if > the problem is *definitely* that code so that I can close a bug in the > GCC tracker. The problem semantically is that you convert type, which would/should create a copy of a limited object. Within a declaration ":=" denotes initialization. You may not convert anything initializing a limited object. Proper ways to go: O : constant Archiver.Archive_t'Class := Archiver.Open_Archive (A, "file.zip"); or O :Archiver.Archive_t'Class renames Archiver.Open_Archive (A, "file.zip"); or (with type casing, which is a *view* conversion) O : Archiver.Archive_t renames Archiver.Archive_t (Archiver.Open_Archive (A, "file.zip")); >> But never ever return pointers to components without an urgent need. > > Is it possible to save the return value of Open_Archive, or not? No, the type is limited it does not have "values", which can be saved (copied). You can create an object initialized in a way that its state would correspond to the desired value. P.S. ":=" for initialization of limited objects might look misleading (and does look misleading to me), but that would be another discussion on Ada design, in which nobody would agree with me. So I prefer not to go into it. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de