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: 18 Nov 92 20:49:27 GMT From: cis.ohio-state.edu!zaphod.mps.ohio-state.edu!wupost!uwm.edu!biosci!agate! linus!linus.mitre.org!maestro!jclander@ucbvax.Berkeley.EDU (Julian C. Lander) Subject: Re: HELP! Input/Output of private types Message-ID: <1992Nov18.204927.12829@linus.mitre.org> List-Id: In article , kist@acsu.buffalo.edu (james e kist) writes: |> Someone please help! How can I use 'put' on a private type that is not |> fully delcared in the specification? This is my situation: |> |> generic |> type Element is private; |> package abcd |> . |> . |> . |> end abcd; |> |> Now, how do I do I/O on an object that is of type Element? Thanks for any |> help. The short answer is that you can't. The long answer is to change the generic formal part so that it reads as follows: generic type Element is private; with procedure Put_Element (File : in Text_IO.File_Type; The_Elt : in Elemen t); with procedure Get_Element (File : in Text_IO.File_Type; The_Elt : out Eleme nt); package abcd . . . . end abcd; This means that the user of the generic package will need to supply procedures for reading and writing data objects of type Element. I'd suggest including File in both profiles, since that lets you write to any file. To write to the standard output, you would say Put_Element (Text_IO.Standard_Output, The_Elt). (I suppose that even greater generality would involve reading from and writing to strings, but I digress.) Good luck. Julian C. Lander jclander@mitre.orgg