Re: Problem with generic parameter



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;

.



Relevant Pages

  • Problem with generic parameter
    ... a test program) GNAT 3.15p reports: ... indexed measurement arrays. ... package Measurement_Text_IO is ... type Limit is; ...
    (comp.lang.ada)
  • Re: Low absorption SMD capacitors
    ... that I measured for other ceramic-material 0805 capacitors. ... Is ordinary FR4 PCB ... and I subtract this out by taking a dark measurement at the ... Another 'oddity' is that the SO8 package of this device (which I'm ...
    (sci.electronics.design)
  • Re: Problem with generic parameter
    ... type Indices is; package Generic_Root type Measurement is array of Measurement; ... new Generic_Root (Scalar => Scalar); ...
    (comp.lang.ada)
  • Re: Looking for a dealer for my Image processing software
    ... Does your SW package support any more advanced ... I know that ImageJ is really memory hungry and rather slow. ... 13 Nodularity Measurement ... Report Tool for reporting ...
    (sci.techniques.microscopy)
  • Re: Looking for a dealer for my Image processing software
    ... What kind of algorithms do you use for instance for segmentation ... Does your SW package support any more advanced ... I know that ImageJ is really memory hungry and rather slow. ... 13 Nodularity Measurement ...
    (sci.techniques.microscopy)

Loading