comp.lang.ada
 help / color / mirror / Atom feed
* IO in generic packages
@ 1983-08-24  1:53 brad
  1983-08-28 19:01 ` Litvintchouk
  0 siblings, 1 reply; 3+ messages in thread
From: brad @ 1983-08-24  1:53 UTC (permalink / raw)


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)

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: IO in generic packages
  1983-08-24  1:53 IO in generic packages brad
@ 1983-08-28 19:01 ` Litvintchouk
  1983-08-28 19:22   ` Litvintchouk
  0 siblings, 1 reply; 3+ messages in thread
From: Litvintchouk @ 1983-08-28 19:01 UTC (permalink / raw)


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.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: IO in generic packages
  1983-08-28 19:01 ` Litvintchouk
@ 1983-08-28 19:22   ` Litvintchouk
  0 siblings, 0 replies; 3+ messages in thread
From: Litvintchouk @ 1983-08-28 19:22 UTC (permalink / raw)


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).

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~1983-08-28 19:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1983-08-24  1:53 IO in generic packages brad
1983-08-28 19:01 ` Litvintchouk
1983-08-28 19:22   ` Litvintchouk

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox