home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!haven.umd.edu!darwin.sura.net!jvnc.net!netnews.upenn.edu!uofs!guinness.cs.uofs.edu!beidler
- From: beidler@guinness.cs.uofs.edu (Jack Beidler)
- Newsgroups: comp.lang.ada
- Subject: Re: Generics?
- Message-ID: <11001@platypus.uofs.uofs.edu>
- Date: 14 Sep 92 15:00:11 GMT
- References: <tp923021.715953043@jarrah>
- Sender: news@uofs.uofs.edu
- Organization: Department of Computing Sciences
- Lines: 67
- Nntp-Posting-Host: guinness.cs.uofs.edu
-
- In article <tp923021.715953043@jarrah>, tp923021@jarrah.canberra.edu.au (Ben Elliston) writes:
- |> Thanks to those regarding my problem with the case statement .. all
- |> fixed now .. and much appreciated!
- |>
- |> I've since moved onto making an array a generic type (such as this):
- |>
- |> GENERIC
- |> Type Index IS (<>);
- |>
- |> [..]
- |>
- |> Type Stack_Array IS Array(Index) of Character;
- |>
- |> Type Stack_Type IS RECORD
- |> Data_Store: Stack_Array;
- |> Pointer: Natural;
- |> END RECORD;
- |>
-
- Something still seems to be missing -- given the two other follow
- ups to this article, I guess that I'm not the only one. Let me add
- my two cents. My package spec. for this package is:
-
- generic
-
- type Object_Type is private ; -- only one generic instantiation parm.
-
- package Stack_Pt_Pt is
-
- Type Stack_Type (Max_Size : positive := 32) is private ;
-
- . . .
- -- Push, Pop, and other specs. here
-
- private
-
- type Stack_Array_Type is array (positive range <>) of Object_Type ;
-
- type Stack_Type (Max_Size : positive := 32) is
- record
- Top : natural := 0 ;
- Actual : Stack_Array_Type (1 .. Max_Size) ;
- end record ;
-
- end Stack_Pt_Pt ;
-
- By having Stack_Type declared with a discriminant, the client has
- control over determining the max. size of each stack.
-
- My convention for component package names is:
-
- Component_Xxx_Yyy
-
- where "Component" is the component supportted by the package,
- "Xxx" is "Pt" or "Lpt" to indicate the type of instantiation
- parameter being supportted, and "Yyy" is either "Pt", "Lpt",
- or "En" to indicate the component visibility as either private,
- limited private, or totally encapsulated (One copy) by the package.
- --
- +------------------------------------------------------------------+
- | John (Jack) Beidler |
- | Prof. of Computer Science Internet: BEIDLER@JAGUAR.UOFS.ED |
- | University of Scranton beidler@guinness.cs.uofs.edu|
- | Scranton, PA 18510 Bitnet : BEIDLER@SCRANTON |
- | |
- | Phone: (717) 941-7446 FAX: (717) 941-4250 |
- +------------------------------------------------------------------+
-