From: dommo1234@my-deja.com
Subject: Generic type parameters
Date: 1999/06/14
Date: 1999-06-14T00:00:00+00:00 [thread overview]
Message-ID: <7k3ae5$stk$1@nnrp1.deja.com> (raw)
This query regards generic packages, and their instantiation with some
actual type.
OK, I have a generic package that requires to be instantiated with a
number of different types. The generic has a number of primative methods
that need to return either the type that the generic package was
instantiated with, an access to the type, or a constant access to the
type, as in the example below :-
generic
type TypeX is private;
package Example is
function One(..) return TypeX;
function Two(..) return TypeX_A;
function Three(..) return TypeX_AC;
end Example;
... where 'TypeX_A' needs to be "access all TypeX"
and 'TypeX_AC' needs to be "access constant TypeX".
The problem is that if I delcare the two types 'TypeX_A' and 'TypeX_AC'
inside the generic, then any code containing variables that catch the
values of functions 'Two' and 'Threee' inside my generic must be of type
<generic inst>.Type_A etc. This is not very readable or convenient!
The only (not so sensible) solution I can think of is provide the
generic with 3 formal parameters, ie. TypeX, TypeX_A and TypeX_AC ....
Does anyone have a neater solution to this??
Thanks,
Dom.
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
next reply other threads:[~1999-06-14 0:00 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
1999-06-14 0:00 dommo1234 [this message]
1999-06-15 0:00 ` Generic type parameters Matthew Heaney
1999-06-15 0:00 ` dommo1234
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox