comp.lang.ada
 help / color / mirror / Atom feed
* Streaming limited tagged types
@ 2002-12-16  8:36 Dmitry A. Kazakov
  2002-12-16 23:32 ` Stephen Leake
  2002-12-17  0:53 ` Randy Brukardt
  0 siblings, 2 replies; 4+ messages in thread
From: Dmitry A. Kazakov @ 2002-12-16  8:36 UTC (permalink / raw)


Hi!

Two problems with that:

1. S'Input is not defined for a limited type. I could define it, but
it seems that S'Class'Input will be still undefined.

2. Should I have S'Class'Input it would not help much in the case when
the object should be allocated in the heap. "new" with a qualified
expression will not work for a limited type.

Is there a way to stream limited tagged types?

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



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

* Re: Streaming limited tagged types
  2002-12-16  8:36 Streaming limited tagged types Dmitry A. Kazakov
@ 2002-12-16 23:32 ` Stephen Leake
  2002-12-18  9:36   ` Dmitry A. Kazakov
  2002-12-17  0:53 ` Randy Brukardt
  1 sibling, 1 reply; 4+ messages in thread
From: Stephen Leake @ 2002-12-16 23:32 UTC (permalink / raw)


Dmitry A. Kazakov <mailbox@dmitry-kazakov.de> writes:

> 2. Should I have S'Class'Input it would not help much in the case when
> the object should be allocated in the heap. "new" with a qualified
> expression will not work for a limited type.
> 
> Is there a way to stream limited tagged types?

Why is the type limited in the first place? Normally, that's because
you _should not_ copy it. So streaming it doesn't make any sense.

-- 
-- Stephe



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

* Re: Streaming limited tagged types
  2002-12-16  8:36 Streaming limited tagged types Dmitry A. Kazakov
  2002-12-16 23:32 ` Stephen Leake
@ 2002-12-17  0:53 ` Randy Brukardt
  1 sibling, 0 replies; 4+ messages in thread
From: Randy Brukardt @ 2002-12-17  0:53 UTC (permalink / raw)


Dmitry A. Kazakov wrote in message ...
>Hi!
>
>Two problems with that:
>
>1. S'Input is not defined for a limited type. I could define it, but
>it seems that S'Class'Input will be still undefined.
>
>2. Should I have S'Class'Input it would not help much in the case when
>the object should be allocated in the heap. "new" with a qualified
>expression will not work for a limited type.
>
>Is there a way to stream limited tagged types?

This is completely botched in Ada 95. We tried to fix it in the
Corrigendum (see 13.13.1(35-36)), but that isn't quite right either.
AI-195 attempts to fix it again; time will tell if we've gotten it right
this time. (I'm not counting on it.) WG9 approved AI-195 at it's recent
meeting (last Friday). So, you just have to convince your favorite
compiler vendor to implement it. (Note, this is not an Amendment AI.)

            Randy Brukardt, ARG Editor.





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

* Re: Streaming limited tagged types
  2002-12-16 23:32 ` Stephen Leake
@ 2002-12-18  9:36   ` Dmitry A. Kazakov
  0 siblings, 0 replies; 4+ messages in thread
From: Dmitry A. Kazakov @ 2002-12-18  9:36 UTC (permalink / raw)


On 16 Dec 2002 18:32:22 -0500, Stephen Leake
<Stephen.A.Leake@nasa.gov> wrote:

>Dmitry A. Kazakov <mailbox@dmitry-kazakov.de> writes:
>
>> 2. Should I have S'Class'Input it would not help much in the case when
>> the object should be allocated in the heap. "new" with a qualified
>> expression will not work for a limited type.
>> 
>> Is there a way to stream limited tagged types?
>
>Why is the type limited in the first place?

Consider some sort of objects accessed through smart pointers, handles
whatsoever. These objects will never be copied using :=. They will
highly likely be limited to have access discriminants for instance, or
to be tasks etc. Now you want to archive these objects in a data base.
A possible way is to abstract the data base interface as a stream
object (which is not stream at all (:-))) because stream attributes
are so excellent for tagged types. Here you are.

>Normally, that's because
>you _should not_ copy it. So streaming it doesn't make any sense.

Copy /= construct. The goal of S'Input is not to copy, but to
construct a new object. It is just an unfortunate side effect that it
appears as a function. Constructor is not a function, however a
function can be used to generate constructor: ":= <function call>".
And this arbitrary use of := triggers the problem.

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



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

end of thread, other threads:[~2002-12-18  9:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-12-16  8:36 Streaming limited tagged types Dmitry A. Kazakov
2002-12-16 23:32 ` Stephen Leake
2002-12-18  9:36   ` Dmitry A. Kazakov
2002-12-17  0:53 ` Randy Brukardt

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