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,6eac62e4f2badf3a X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-04-10 07:40:25 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!newsfeed.stueberl.de!fu-berlin.de!uni-berlin.de!82-43-33-254.cable.ubr01.croy.blueyonder.co.UK!not-for-mail From: Nick Roberts Newsgroups: comp.lang.ada Subject: Re: Persistence of limited tagged types Date: Thu, 10 Apr 2003 15:40:30 +0100 Organization: ThoughtWing Computer Software Message-ID: References: <1ec946d1.0304091509.150cc6d7@posting.google.com> NNTP-Posting-Host: 82-43-33-254.cable.ubr01.croy.blueyonder.co.uk (82.43.33.254) Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15; format=flowed X-Trace: fu-berlin.de 1049985623 11457363 82.43.33.254 (16 [25716]) In-Reply-To: <1ec946d1.0304091509.150cc6d7@posting.google.com> User-Agent: Opera7.03/Win32 M2 build 2670 Xref: archiver1.google.com comp.lang.ada:36054 Date: 2003-04-10T15:40:30+01:00 List-Id: On 9 Apr 2003 16:09:09 -0700, Matthew Heaney wrote: > Is T'Output available if type T is limited? According to the RM95 (13.13 (36)) (which I'm certain you must have already consulted, Matt) the stream-oriented attributes (Read, Write, Input, Output) are defined for all types, but defaults are not provided for limited types. > GNAT lets me declare an output operation: > > type T is limited null record; > > procedure Output (Stream : access Root_Stream_Type'Class; > Item : in T); > > for T'Output use Output; > > but then it refuses to let me call it: > > O : T; > begin > T'Output (Stream, O); > end; > > I get an error message that "limited type T has no stream attributes." > > However, if I define T'Write, then GNAT compiles > > T'Write (Stream, O); > > without complaint. > > What's up with that? Is the expectation that T'Output can't be used > for a limited type? Why does GNAT allow me to define the T'Output > stream attribute [but not call it]? I don't immediately see how this (GNAT's) behaviour obeys the standard. It could be argued that since T in this example is a definite type, it is not actually necessary to define or call T'Output, since T'Write could be defined and called instead with the same effect. But I don't see how this could permit GNAT to produce the error it does. Perhaps I should ask which version of GNAT this was, and do some tests myself? -- Nick Roberts Jabber: debater@charente.de [ICQ: 159718630]