From: Natasha Kerensikova <lithiumcat@instinctive.eu>
Subject: How to declare a generic formal type "covered" by another?
Date: Thu, 1 May 2014 06:54:29 +0000 (UTC)
Date: 2014-05-01T06:54:29+00:00 [thread overview]
Message-ID: <slrnlm3rt4.i0l.lithiumcat@nat.rebma.instinctive.eu> (raw)
Hello,
this a general question stemmed by a new idea on how to solve the
problem exposed in my previous thread (I wouldn't have started a new
thread if I knew my newsreader well enough to do so).
I'm not good enough with language-lawyer vocabulary (hence the quotes
around "covered" in the subject), so I'll write it mostly in Ada.
Basically I want two generic formal T and S, so that I can write:
Access_To_T_Value := new S;
I too the verb "cover" from 4.8(3/1) to mean this relationship between S
and T, but I'm not sure how correct it is.
The context would look like that:
generic
type T (<>) is limited private;
package References is
type Exposed_Type is tagged private;
generic
type S is adequately declared;
function Allocate return Exposed_Type;
private
type Internal_Access is access T;
type Exposed_Type is new Ada.Finalization.Controlled with record
Value : Internal_Access;
end record;
end References;
package body References is
function Allocate return Exposed_Type is
begin
return (Ada.Finalization.Controlled with
Value => new S);
end Allocate;
end References;
So S would have to be a concrete constrained type, but looking at the
alternatives for "formal_type_definition", I can't see anything that
covers both S being a constrained version of T, and S being a concrete
tagged type belonging to class-wide T.
Is it possible, or am I hitting a limit of Ada generics?
Thanks for your help,
Natasha
next reply other threads:[~2014-05-01 6:54 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-01 6:54 Natasha Kerensikova [this message]
2014-05-01 7:09 ` How to declare a generic formal type "covered" by another? J-P. Rosen
2014-05-01 7:33 ` Natasha Kerensikova
2014-05-01 13:35 ` J-P. Rosen
2014-05-01 17:56 ` Natasha Kerensikova
2014-05-01 20:59 ` Jeffrey Carter
2014-05-02 7:58 ` AdaMagica
2014-05-02 8:17 ` Natasha Kerensikova
2014-05-02 15:12 ` Jeffrey Carter
2014-05-02 15:33 ` Dmitry A. Kazakov
2014-05-02 16:00 ` AdaMagica
2014-05-01 9:30 ` Georg Bauhaus
2014-05-01 9:32 ` Georg Bauhaus
2014-05-01 9:33 ` Georg Bauhaus
2014-05-01 16:34 ` Georg Bauhaus
2014-05-01 18:11 ` Natasha Kerensikova
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox