From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.5-pre1 (2020-06-20) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-1.9 required=3.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.5-pre1 Date: 14 Sep 92 15:00:11 GMT From: cis.ohio-state.edu!zaphod.mps.ohio-state.edu!darwin.sura.net!jvnc.net!net news.upenn.edu!uofs!guinness.cs.uofs.edu!beidler@ucbvax.Berkeley.EDU (Jack Bei dler) Subject: Re: Generics? Message-ID: <11001@platypus.uofs.uofs.edu> List-Id: In article , tp923021@jarrah.canberra.edu.au (Ben El liston) 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 | +------------------------------------------------------------------+