Extension d'agrégat privée avec un type générique.

Pascal <[email protected]>
Newsgroups gmane.comp.lang.ada.france
Message-ID <[email protected]>
Bonjour, pas facile de trouver un titre de message parlant pour le casse tête suivant.

Je tombe sur l'exemple 8.a.1/1 du § 6.3.1 Conformance Rules de l'AARM Ada 2012 que j'essaye de compiler.
L'exemple est partiel, j'ai ajouter 2 ou 3 choses pour qu'il soit valide et notamment je doit donner une valeur initial à X.
Le type de X est une extension indéfinie d'un type étiqueté Root défini et paramètre formel du paquetage générique G:
   -- 6.3.1 Conformance Rules
   procedure Parapraph_6_3_1_8 is
      package P is
         type Root is tagged null record;
         procedure Proc(X: Root) is null;
      end P;

      generic
         type Formal(<>) is new P.Root with private; --@@
      package G is
         -- ...
      end G;

      package body G is
         -- ...
         X: Formal := Formal'(P.Root with private); -- PB
         -- ...
      begin
         Proc(X); -- This is a dispatching call in Instance, because
         -- the actual type for Formal is class-wide.
         -- ...
         -- Proc'Access would be illegal here, because it is of
         -- convention Intrinsic, by the above rule.
      end G;

      type Actual is new P.Root with null record; --@@
      procedure Proc(X: Actual) is null;
      package Instance is new G(Formal => Actual'Class);
      -- It is legal to pass in a class-wide actual, because Formal
      -- has unknown discriminants.
   begin
      null;
   end;

Bon, évidemment le "Formal'(P.Root with private)" ne passe pas, mais que mettre à la place ?

Surement tout bête...

Merci pour votre aide, Pascal.
http://blady.pagesperso-orange.fr


_______________________________________________
Site WWW de l'association Ada-France: http://www.ada-france.org/
[email protected]
http://www.ada-france.org/mailman/listinfo/ada-france
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.