From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=BAYES_00,INVALID_DATE, T_FILL_THIS_FORM_SHORT autolearn=no autolearn_force=no version=3.4.4 Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.3 4.3bsd-beta 6/6/85; site ucbvax.ARPA Path: utzoo!watmath!clyde!burl!ulysses!ucbvax!su-sierra.arpa!BRYAN From: BRYAN@SU-SIERRA.ARPA (Doug Bryan) Newsgroups: net.lang.ada Subject: Re: Mutually Recursive Data-Structures in ADA Message-ID: <8509191758.AA23499@UCB-VAX.ARPA> Date: Thu, 19-Sep-85 01:38:45 EDT Article-I.D.: UCB-VAX.8509191758.AA23499 Posted: Thu Sep 19 01:38:45 1985 Date-Received: Sun, 22-Sep-85 05:27:02 EDT References: Sender: daemon@ucbvax.ARPA Organization: The ARPA Internet List-Id: Geoffrey, Submitted for your consideration: --------------------- generic type File is limited private; package Item_Pac is type Item is limited private; function Get_File (Of_Item : Item) return File; -- other operations... private type Item is record F : File; -- other data end record; end Item_Pac; package body Item_Pac is ... end Item_Pac; --------------------- generic type Item is limited private; package Parameter_Pac is type Parameter is limited private; function Get_Item (Of_Parameter : Parameter) return Item; -- other operations... private type Parameter is record I : Item; -- other data end record; end Parameter_Pac; package body Parameter_Pac is ... end Parameter_Pac; --------------------- with Item_Pac, Parameter_Pac; package File_Pac is type File is limited private; type Access_File is access File; package Items is new Item_Pac (File => Access_File); package Parameters is new Parameter_Pac (Item => Items.Item); function Get_Parameter (Of_File : File) return Parameters.Parameter; function Get_Parameter (Of_File : Access_File) return Parameters.Parameter; -- other operations... private type File is record P : Parameters.Parameter; -- other data end record; end File_Pac; package body File_Pac is ... end File_Pac; ------------------ Now the users need simply "with" File_Pac to get the operations on all three abstract data types. The types need not be limited. We used limited types to show that this method should work for any actual implementations of the types. what think you? Doug Bryan Geoff Mendal bryan@su-sierra Mendal%UMich-MTS.Mailnet@MIT-Multics.ARPA Stanford U. Lockheed Missiles & Space Company, Inc. -------