[comp.lang.ada] TEXT_IO

marcus@fkihh.UUCP (Marcus Moehrmann) (05/12/88)

Hello,
I have a question concerning TEXT_IO. Consider the following program:

with TEXT_IO;
use  TEXT_IO;
procedure TEST is
begin
--   SET_INPUT  (STANDARD_INPUT);    -- (1)
--   SET_OUTPUT (STANDARD_OUTPUT);   -- (1)
   DO_SOMETHING;
   PUT_LINE ("After doing something");   -- (2)
end TEST;

Now, LRM 14.3(5) states, that the standard IO files are open *at the
beginning* of the program execution and have the appropriate modes.

But what has to be done, if they cannot be opened because of
NAME_ERROR or USE_ERROR ? E.g. with VAX/VMS you can do the following:
   $ DEFINE ADA$OUTPUT <filename-which-raises-io-error-at-TEXT_IO.CREATE>
and something equal for ADA$INPUT. After that STANDARD_OUTPUT cannot
be opened at the beginning of the program execution. I think, the same
can be done in other operating-systems like UNIX or MS/DOS.

Now the question is, *when* to raise the IO error, e.g. NAME_ERROR ?
During elaboration of TEXT_IO, at first use of STANDARD_IO ?

This is what happens with VAX Ada V1.4-33:

   If statements (1) are active, NAME_ERROR will be raised here 

   If statement (1) are commented out, NAME_ERROR will be raised at (2),
   after doing something else.
   
Therefor in Vax Ada statements (1) are neccessary to prevent doing
something after the beginning of the program execution but befor an IO
statement is reached. I feel, that there must not be a difference if
statements (1) are active or not (commented out).


*** Marcus Moehrmann                |  UUCP:    marcus@fkihh.UUCP ***
*** (TeX: M\"{o}hrmann)             |  PHONE:   +49-40-4123-2573  ***
*** Univ of Hamburg, W. Germany     |           +49-40-5202464    ***