comp.lang.ada
 help / color / mirror / Atom feed
From: Martin Krischik <krischik@users.sourceforge.net>
Subject: Re: record extension aggregate for returned type legal?
Date: Wed, 13 Oct 2004 09:52:46 +0200
Date: 2004-10-13T09:52:46+02:00	[thread overview]
Message-ID: <6577257.BAFHMKqgPc@linux1.krischik.com> (raw)
In-Reply-To: ckheim$s7o$1@a1-hrz.uni-duisburg.de

Georg Bauhaus wrote:

> Martin Krischik <krischik@users.sourceforge.net> wrote:
> : T' (spoken T kick) tells the compiler that the next expression is of
> : type T. i.E: Positive'(1) means that you want a Positive and not an
> : Integer. If you won't say anything the compiler will choose automaticly.
> 
> In this case T is specific, and `make` is not a primitive operation
> of T (because make is in child package B). So does the compiler
> have a choice at all?
> 
> LRM 4.3.2, quoted in one compiler's error message, says,
> 
>   4. The expected type for an extension_aggregate shall be a single
>      nonlimited type that is a record extension. If the ancestor_part
>      is an expression, it is expected to be of any nonlimited tagged
>      type.
> 
> Do I understand this phrase? The expected type in the return expression
> for "function make return T" is the specific tagged type T.
> In "return (n => 0)", there is no extension aggregate.
> In "return (T with n => 0)", there is an extension aggregate,
> the ancestor part being T.

But T in your example is a root class and therefore has no ancestor. T needs
an standart aggregate and not an extension aggregate.

> T is not limited.
> T is not an extension (a record extension?).
> Does T have an ancestor (does T maybe count as an ancestor of T here?)

Consider the other constructor pattern:

type P is abstract tagged private;
type C is new P with private;

function Create returns P'Class;

function Create
returns
    P'Class
is
begin
    return C'(P with ...);
end Create

With Regards.

Martin

-- 
mailto://krischik@users.sourceforge.net
http://www.ada.krischik.com




  reply	other threads:[~2004-10-13  7:52 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-10-12  1:31 record extension aggregate for returned type legal? Georg Bauhaus
2004-10-12  8:04 ` Martin Krischik
2004-10-12 14:36   ` Georg Bauhaus
     [not found]     ` <1940150.rU8f1KaX3L@linux1.krischik.com>
2004-10-12 20:24       ` Georg Bauhaus
2004-10-13  7:52         ` Martin Krischik [this message]
     [not found]           ` <ckjlhm$2hh$1@a1-hrz.uni-duisburg.de>
     [not found]             ` <ukhbd.106086$dP1.396181@newsc.telia.net>
2004-10-14  0:29               ` Is T an ancestor of T? Georg Bauhaus
2004-10-14  8:54             ` Is T an ancestor of T? (was: Re: record extension aggregate for returned type legal?) Martin Krischik
     [not found]               ` <ckot3m$hek$1@a1-hrz.uni-duisburg.de>
2004-10-15 16:55                 ` Is T an ancestor of T? Martin Krischik
2004-10-15 17:19                   ` Georg Bauhaus
2004-10-16 14:37                     ` Martin Krischik
2004-10-13 16:18       ` record extension aggregate for returned type legal? Jean-Pierre Rosen
     [not found]         ` <87ekk0hvfq.fsf@beeblebrox.rfc1149.net>
2004-10-15 16:51           ` Martin Krischik
     [not found]           ` <t7tokc.2he.ln@skymaster>
2004-10-15 17:22             ` Georg Bauhaus
2004-10-14 20:04       ` Simon Wright
replies disabled

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