* Abstraction of variable size arrays - Help !!!
@ 1990-07-18 19:27 Louis-Simon Binette
0 siblings, 0 replies; only message in thread
From: Louis-Simon Binette @ 1990-07-18 19:27 UTC (permalink / raw)
Valcartier, 17 July
Dear Folks,
I am currently in the process of designing a generic package that
encapsulates variable size vectors whose components are referenced by a
discrete type. The basic declarations of the package specification are:
generic
type GT_ELM is private; -- Element type
type GT_NDX is (<>); -- Index type of vector
package VECTOR_MNGR_TEMPLATE is
type T_VECTOR is limited private;
-- Other declarations come here (types and subprograms)
with T_VECTOR being the abstract data type for the variable size
vector. In order to extend the functionality of the language with res-
pect to the bounds of arrays [LRM 3.6.1] I have encapsulated the actual
values of the lower and upper bounds as part of the vector structure:
private
...;
type T_VECTOR is record
LOWER_BOUND,
UPPER_BOUND : ...; -- Base type of GT_NDX !!!
...;
end record;
...;
end VECTOR_MNGR_TEMPLATE;
As you might know, the range covered by the bounds of the array is
defined by the _base type_ of GT_NDX [LRM 3.5 (4)] in order to cope with
_null arrays_. Unfortunately, a type declaration like:
type T_BASE_NDX is range GT_NDX'BASE'FIRST..GT_NDX'BASE'LAST;
in the package is illegal since the bounds are not static (as spe-
cified in LRM 4.9 (11): "...other than a generic formal type;...").
Any opinion about what looks to me as a lack of extensibility of the
language? I would greatly appreciate suggestions (if any !) to this pro-
blem while keeping the genericity ("type GT_NDX is (<>);") of the package
Thanks in advance
Louis-Simon Binette
Internet : simon@quebec.drev.dnd.ca
IP...... : simon@131.132.32.18
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~1990-07-18 19:27 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1990-07-18 19:27 Abstraction of variable size arrays - Help !!! Louis-Simon Binette
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox