comp.lang.ada
 help / color / mirror / Atom feed
From: madmats@elma.epfl.ch (Mats Weber)
Subject: Limited types and generic parameters
Date: 22 Feb 89 12:27:12 GMT	[thread overview]
Message-ID: <890222132712.21a009c0@elcc.epfl.ch> (raw)

Question on limited types and generic parameters.
Consider the following piece of Ada code:

   generic
      type T is limited private;
   package GP is

      type R is
         record
            F : T;
         end record;

   end GP;

   package P is new GP(T => INTEGER);

   X : P.R := (F => 45);  -- *
   Y : P.R := (F => 77);  -- *

   ...

   X.F := 56;
   X := Y;                -- *


   Are the *-marked assignments correct ? In other words, is P.R a limited
   type ?

   LRM 7.4.4(2) says: "... a composite type is limited if the type
   of any of its subcomponents is limited."

   In this case, there are two possible interpretations:
      - The declaration of type P.R occurs in the context of the generic
        package GP.
      - The declaration of type P.R occurs in the context of the instance P.

   According to LRM 12.3(9) "For a name that denotes a generic formal type:
   The corresponding name denotes the subtype named by the associated
   generic actual parameter (the actual subtype)." The second interpretation
   seems to be the right one, which would make the type P.R non limited.

   What do you think ? (I would like J. Goodenough to see this).


Mats Weber
Swiss Federal Institute of Technology
EPFL DI LITh
1015 Lausanne
Switzerland

e-mail : madmats@elma.epfl.ch

             reply	other threads:[~1989-02-22 12:27 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1989-02-22 12:27 Mats Weber [this message]
1989-02-22 14:58 ` Limited types and generic parameters Fred Hosch
  -- strict thread matches above, loose matches on Subject: below --
1989-02-23  5:51 Karl Nyberg
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox