comp.lang.ada
 help / color / mirror / Atom feed
From: Adam Beneschan <adam@irvine.com>
Subject: Re: Does 3.9.3(10) apply to untagged private whose full view is tagged?
Date: Thu, 26 Jul 2007 08:07:51 -0700
Date: 2007-07-26T08:07:51-07:00	[thread overview]
Message-ID: <1185462471.150936.319550@e9g2000prf.googlegroups.com> (raw)
In-Reply-To: <1185446419.28126.44.camel@kartoffel>

On Jul 26, 3:40 am, Georg Bauhaus <rm.tsoh+bauh...@maps.futureapps.de>
wrote:
> On Thu, 2007-07-26 at 08:58 +0000, anon wrote:
> > Compiling: pak1.ads (source file time stamp: 2007-07-25 03:27:16)
>
> >      1. package Pak1 is
> >      2.    type T1 is private;
> >      3.
> >      4. private
> >      5.    type T1 is tagged record
> >      6.       F1 : Integer;
> >      7.   end record;
> >      8.   function Func (X : Integer) return T1 ;
> >                    |
> >         >>> private function with tagged result must override visible-part function
> >         >>> move subprogram to the visible part (RM 3.9.3(10))
>
> >      9. end Pak1;
> >     10.
> > Ada 95: RM 3.9.3 (10) says
> > ...  For a tagged
> > type declared in a visible part,
>
> T1 is not visibly tagged nor abstract. The RM rule seems to apply
> to visibly tagged types. I'd, too,  be interested in a continuation
> of GNAT's first message: "must override visible-part function
> for a type that is ...".

The wording of GNAT's message is a bit sideways IMHO.  In general, for
a visibly tagged type, the rule is that you can't have a function with
a controlling result that returns that type in the private part; the
exception to the rule is in the case where the visible type is derived
and the function with a controlling result overrides an inherited
function.  The GNAT phrasing makes it seem like the "exceptional" case
here is the normal case, and that the mistake is not making the
function override something.  I think their message may be logically
equivalent to the real rule (using "logically equivalent" in a
mathematical sense), but the emphasis is wrong, which could cause
users to be confused.

                     -- Adam





      reply	other threads:[~2007-07-26 15:07 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-25 22:04 Does 3.9.3(10) apply to untagged private whose full view is tagged? Adam Beneschan
2007-07-26  5:08 ` AW: " Grein, Christoph (Fa. ESG)
2007-07-26  8:58 ` anon
2007-07-26 10:40   ` Georg Bauhaus
2007-07-26 15:07     ` Adam Beneschan [this message]
replies disabled

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