NICE-ESG-Libs Digest Tue, 6 Jun 95 Volume 1 : Issue 242
Today's Topics:
IO
NICE Eiffel Standards Group -- Library Committee Mailing List
To post to list:
NICE-ESG-Libs@atlanta.twr.com
To send mail to the Chairman of the committee:
NICE-ESG-Libs-chair@atlanta.twr.com
Administrative matters (sign up, unsubscribe, mail problems, etc):
NICE-ESG-Libs-request@atlanta.twr.com
Date: Tue, 6 Jun 95 10:50:19 EDT
From: tynor (Steve Tynor)
Subject: IO
To: NICE-ESG-Libs@atlanta.twr.com
Steve Fisher wrote:
| Of those so far suggested I favour `skip_to_next_line' as all the output
| features start with put_, I do not expect any confusion.
I agree: `skip_to' definitely connotes `input' to me too (how can you
skip over something you haven't written yet? :-))
| Finally I note that in GENERAL we have the feature io : STD_FILES but
| that STD_FILES has a state (stored in `default_output'). This means
| that any software using put_xxxx must first store the default_ouput,
| set it, put, and reset the original state. STD_FILES corresponds to
| stdin, stdout or stderr so it would have been much more pleasant to
| have stdin, stdout and stderr as three stateless streams rather than
| io.
Actually, since `io', `input', `error' etc. are typically implemented a
once functions, so the initialization is implicit. In our current
implementation, `io' is implemented as:
io: STANDARD_FILES is
-- Standard input and output
once
!!Result.make;
ensure
not_void: Result /= Void;
end;
and STANDARD_FILES' `make' is defined as:
make is
do
set_output_default;
end;
and the various `input', `output' and `error' streams are initialized
as :
output: TEXT_STREAM is
-- Standard output file
local
s : FD_IO;
once
!!s.open (1, "w");
!!Result.make (s);
end;
(of course, we need to rename our class to STD_FILES for compatibility
with the PELKS name, but you get the idea...). All the initialization of
the streams is implicit -- the caller need not do anything more than a
call to a `put_' or `read_' routine (e.g. `io.put_integer (1)' or even
`io.error.put_integer(1)') to get everything initialized, etc.
Steve

|
|