Re: Problem with generic parameter
- From: Marius Amado Alves <amado.alves@xxxxxxxxxx>
- Date: Wed, 22 Jun 2005 13:43:07 +0100
I, Marius Amado Alves, just wrote:
I think this is legal, so the compiler is buggy. But I find it an unlogical generic idiom, and probably the bug has passed unnoticed before for this reason. That is, nobody wrote this before. What I find unlogical is the Generic_Root.Child parameters. I would find it logical to represent the array type as an exported entity instead of a generic parameter.
generic type Indices is (<>); package Generic_Root type Measurement is array (Indices) of Measurement;
Here's the complete 'logical' idiom, which also corrects faults above:
generic
type Indices is (<>);
package Generic_Root.Child_By_Marius is
type Measurement_Array is
array (Indices range <>) of Measurement;
end;with Generic_Root;
with Generic_Root.Child_By_Marius;
procedure Marius_Demo is
type Scalar is digits 15;
package Measurements is
new Generic_Root (Scalar => Scalar);
package Measurements_Text_IO is
new Measurements.Child_By_Marius
(Indices => Positive);
-- now here you have your unconstrained array type
-- it is Measurements_Text_IO.Measurement_Array
-- and you have defined it only once
-- and the whole thing compiles
begin
null;
end;.
- References:
- Problem with generic parameter
- From: Jacob Sparre Andersen
- Problem with generic parameter
- Prev by Date: Re: Data table text I/O package?
- Next by Date: Re: Serial I/O
- Previous by thread: Re: Problem with generic parameter
- Next by thread: Question on use of ! instead of |
- Index(es):
Relevant Pages
|
Loading