brad@umcp-cs.UUCP (08/24/83)
How do you do Input/Ouput from a generic package when the type input to the package is a private type? I am trying to debug a generic package and want to dump value in the variables during execution, but I suppose that it's just as applicable to general IO. I have read many books, and can't remember seeing this topic addressed. b**2 (Brad Balfour) {seismo, allegra}!umcp-cs!brad (uucp) brad.umcp-cs@UDel-Relay (arpa) brad@umcp-cs (CSNet)
sdl@rayssd.UUCP (Litvintchouk) (08/28/83)
In ANSI '83 Ada, you can do input/output with generic package SEQUENTIAL_IO. It takes ELEMENT_TYPE, the type to be input/output, as a generic formal parameter. Just instantiate the package. I hope your Ada implementation of SEQUENTIAL_IO has FORM parameters which permit the i/o in human readable (ASCII) form (this is implementation dependent). You clearly can't use TEXT_IO because since the type is generic formal private the generic has no way of knowing whether it's text. Another possibility is to import the required input/output functions into the package as generic formal subprograms.
sdl@rayssd.UUCP (Litvintchouk) (08/28/83)
By the way, I forgot to ask: Why would you (or anyone else) ever need to do i/o on variables of a generic formal private type from inside the generic unit? Except for equality tests, your generic unit body can't assume anything about the nature of the private type. Of course, you may be importing functions defined on that type as well to be used in the generic unit, but to check their behavior you should put i/o statements in THEIR bodies (which are defined outside the generic unit).