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=-2.9 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI autolearn=unavailable autolearn_force=no version=3.4.4 X-Google-Thread: 103376,e9247d4ba8198ede X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news3.google.com!news.glorb.com!news.cs.univ-paris8.fr!proxad.net!cleanfeed3-b.proxad.net!nnrp2-1.free.fr!not-for-mail Return-Path: Mime-Version: 1.0 (Apple Message framework v752.2) In-Reply-To: <71E9A504-B016-49E2-AB85-34CCDF0AEEC8@amado-alves.info> References: <71E9A504-B016-49E2-AB85-34CCDF0AEEC8@amado-alves.info> Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Content-Transfer-Encoding: 7bit From: Marius Amado-Alves Subject: Re: Actual stream of a certain type Date: Thu, 27 Jul 2006 01:25:04 +0100 To: comp.lang.ada@ada-france.org X-Mailer: Apple Mail (2.752.2) X-Antivirus-Scanner: Clean mail though you should still use an Antivirus X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - zaphen.serversonline.net X-AntiAbuse: Original Domain - ada-france.org X-AntiAbuse: Originator/Caller UID/GID - [0 0] / [47 12] X-AntiAbuse: Sender Address Domain - amado-alves.info X-Source: X-Source-Args: X-Source-Dir: X-Virus-Scanned: amavisd-new at ada-france.org X-BeenThere: comp.lang.ada@ada-france.org X-Mailman-Version: 2.1.8rc1 Precedence: list List-Id: "Gateway to the comp.lang.ada Usenet newsgroup" List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.ada Message-ID: X-Leafnode-NNTP-Posting-Host: 88.191.17.134 Organization: Guest of ProXad - France NNTP-Posting-Date: 27 Jul 2006 02:25:23 MEST NNTP-Posting-Host: 88.191.14.223 X-Trace: 1153959923 nnrp2-1.free.fr 30108 88.191.14.223:39343 X-Complaints-To: abuse@proxad.net Xref: g2news2.google.com comp.lang.ada:5958 Date: 2006-07-27T02:25:23+02:00 Ok, here it goes. Of all idioms I tried maybe the least unsuccessful (?) ones are those that raise Program_Error with message "accessibility check failed" (GNAT) for line marked HERE below. The problem here is: how to use the stream visible on that line, as the good T_Stream object he is, pass it as a variable, etc? Thanks a great lot. type T_Stream_Class_Access is access all T_Stream'Class; procedure Write_T (Stream : T_Stream_Class_Access; Item : in T) is begin Foobar (Stream.all, Item); end; procedure Write (Stream : not null access Ada.Streams.Root_Stream_Type'Class; Item : in T) is begin if Stream.all not in T_Stream'Class then raise Actual_Stream_Must_Be_A_T_Stream; else Write_T (T_Stream_Class_Access (Stream), Item); -- <== HERE end if; end;