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-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,df17212a7a9dc5fd X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-06-12 01:39:18 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.freenet.de!news.shlink.de!fu-berlin.de!uni-berlin.de!tar-alcarin.cbb-automation.DE!not-for-mail From: Dmitry A. Kazakov Newsgroups: comp.lang.ada Subject: Re: Streams in GNAT 3.14p Date: Wed, 12 Jun 2002 10:43:56 +0200 Message-ID: <460egugo809clqrijsgq4cba6jcbuavkv6@4ax.com> References: <4519e058.0206101114.4b8dfd2f@posting.google.com> NNTP-Posting-Host: tar-alcarin.cbb-automation.de (212.79.194.111) Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: fu-berlin.de 1023871156 4700799 212.79.194.111 (16 [77047]) X-Newsreader: Forte Agent 1.8/32.548 Xref: archiver1.google.com comp.lang.ada:25782 Date: 2002-06-12T10:43:56+02:00 List-Id: On 10 Jun 2002 12:14:41 -0700, dennison@telepath.com (Ted Dennison) wrote: >Dmitry A.Kazakov wrote in message news:... >> Hi! >> >> Recently I found that GNAT 3.14p implementation of streams looks a bit >> strange. When a tagged object is written (S'Class'Output), then >> Write(Stream, Item) is called for each character of the external >> representation of tag _separately_. For types declared in deeply nested >> child packages it is about 100 separate calls. > >That's the way String'Output (and any other array 'Output) works by >default. I suppose they could have optimized it for tag strings >without running afowl of the ARM, but it isn't horribly suprising that >they didn't. I think that a possible way to make Streams usable for internal communication could be [in the future standard] to declare two dispatching operations for Root_Stream_Type dealing with tags: procedure Output (Stream : access Root_Stream_Type; Type_Tag : Tag); function Input (Stream : access Root_Stream_Type) return Tag; They use Ada.Tags.External_Tag/Internal_Tag if not overridden. Then a user could override them with something like: procedure Output (Stream : access Local_Memory_Stream; Type_Tag : Tag) is begin Tag'Output (Stream, Type_Tag); end Output; function Input (Stream : access Local_Memory_Stream) return Tag is begin return Tag'Input (Stream); end Input; Of course Tag'Input and Tag'Output should have reasonable implementations, i.e. input/output tags as-is. --- Regards, Dmitry Kazakov www.dmitry-kazakov.de