Prev | Up | Next | Back | Forward
TOC -- / --.-- / --.--.-- | Index | Search | Syntax | Help


7.5 Limited Types

(1)
A limited type is (a view of) a type for which the assignment operation is not allowed. A nonlimited type is a (view of a) type for which the assignment operation is allowed.
Legality Rules
(2)
If a tagged record type has any limited components, then the reserved word limited shall appear in its record_type_definition.
Static Semantics
(3)
A type is limited if it is a descendant of one of the following:
(4)
(5)
(6)
(7)
Otherwise, the type is nonlimited.
(8)
There are no predefined equality operators for a limited type.

(9)
(10)
(11)
(12)
(13)
(14)
(15)
(16)
Examples
(17)
Example of a package with a limited type:
(18)
       package IO_Package is
          type File_Name is limited private;
(19)
          procedure Open (F : in out File_Name);
          procedure Close(F : in out File_Name);
          procedure Read (F : in File_Name; Item : out Integer);
          procedure Write(F : in File_Name; Item : in  Integer);
       private
          type File_Name is
             limited record
                Internal_Name : Integer := 0;
             end record;
       end IO_Package;
(20)
       package body IO_Package is
          Limit : constant := 200;
          type File_Descriptor is record  ...  end record;
          Directory : array (1 .. Limit) of File_Descriptor;
          ...
          procedure Open (F : in out File_Name) is  ...  end;
          procedure Close(F : in out File_Name) is  ...  end;
          procedure Read (F : in File_Name; Item : out Integer) is ... end;
          procedure Write(F : in File_Name; Item : in  Integer) is ... end;
       begin
          ...
       end IO_Package;

(21)
(22)
(23)


Prev | Up | Next | Back | Forward
TOC -- / --.-- / --.--.-- | Index | Search | Syntax | Help

Ada WWW Home -- Email comments, additions, corrections, gripes, kudos, etc. to:

Magnus Kempe -- Magnus.Kempe@di.epfl.ch
Copyright statement
Page last generated: 95-03-12