From: Marius Amado Alves <amado.alves@netcabo.pt>
To: comp.lang.ada@ada-france.org
Subject: Re: Problem with generic parameter
Date: Wed, 22 Jun 2005 13:43:07 +0100
Date: 2005-06-22T13:43:07+01:00 [thread overview]
Message-ID: <mailman.83.1119444231.17633.comp.lang.ada@ada-france.org> (raw)
In-Reply-To: <f6af3631a69872fe2f46258f86b08473@netcabo.pt>
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;
prev parent reply other threads:[~2005-06-22 12:43 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-06-22 10:21 Problem with generic parameter Jacob Sparre Andersen
2005-06-22 11:16 ` Martin Dowie
2005-06-22 11:58 ` Marius Amado Alves
2005-06-22 13:09 ` Jacob Sparre Andersen
2005-06-22 14:26 ` Marius Amado Alves
[not found] ` <f6af3631a69872fe2f46258f86b08473@netcabo.pt>
2005-06-22 12:43 ` Marius Amado Alves [this message]
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox