comp.lang.ada
 help / color / mirror / Atom feed
* Re: Streams in GNAT 3.14p
  2002-06-11  1:24 Streams in GNAT 3.14p Dmitry A.Kazakov
@ 2002-06-10 19:14 ` Ted Dennison
  2002-06-12  8:43   ` Dmitry A. Kazakov
  0 siblings, 1 reply; 4+ messages in thread
From: Ted Dennison @ 2002-06-10 19:14 UTC (permalink / raw)


Dmitry A.Kazakov <mailbox@dmitry-kazakov.de> wrote in message news:<ae295a$3b12g$1@ID-77047.news.dfncis.de>...
> 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.


-- 
T.E.D. 
Home     -  mailto:dennison@telepath.com (Yahoo: Ted_Dennison)
Homepage -  http://www.telepath.com/dennison/Ted/TED.html



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Streams in GNAT 3.14p
@ 2002-06-11  1:24 Dmitry A.Kazakov
  2002-06-10 19:14 ` Ted Dennison
  0 siblings, 1 reply; 4+ messages in thread
From: Dmitry A.Kazakov @ 2002-06-11  1:24 UTC (permalink / raw)


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.

This makes Ada.Streams near to unusable.

-- 
Regards,
Dmitry Kazakov
www.dmitry-kazakov.de




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Streams in GNAT 3.14p
  2002-06-10 19:14 ` Ted Dennison
@ 2002-06-12  8:43   ` Dmitry A. Kazakov
  2002-06-12 19:50     ` Randy Brukardt
  0 siblings, 1 reply; 4+ messages in thread
From: Dmitry A. Kazakov @ 2002-06-12  8:43 UTC (permalink / raw)


On 10 Jun 2002 12:14:41 -0700, dennison@telepath.com (Ted Dennison)
wrote:

>Dmitry A.Kazakov <mailbox@dmitry-kazakov.de> wrote in message news:<ae295a$3b12g$1@ID-77047.news.dfncis.de>...
>> 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



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Streams in GNAT 3.14p
  2002-06-12  8:43   ` Dmitry A. Kazakov
@ 2002-06-12 19:50     ` Randy Brukardt
  0 siblings, 0 replies; 4+ messages in thread
From: Randy Brukardt @ 2002-06-12 19:50 UTC (permalink / raw)


Dmitry A. Kazakov wrote in message
<460egugo809clqrijsgq4cba6jcbuavkv6@4ax.com>...
>On 10 Jun 2002 12:14:41 -0700, dennison@telepath.com (Ted Dennison)
>wrote:
>
>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:

(rest omitted)

It's such a good idea that it was proposed a couple of years ago. See
AI-260:

    www.ada-auth.org/cgi-bin/cvsweb.cgi/AIs/AI-00260.TXT

This AI is finished, so it should be fairly close to the final feature
adopted.

        Randy Brukardt.







^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2002-06-12 19:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-06-11  1:24 Streams in GNAT 3.14p Dmitry A.Kazakov
2002-06-10 19:14 ` Ted Dennison
2002-06-12  8:43   ` Dmitry A. Kazakov
2002-06-12 19:50     ` Randy Brukardt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox