[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Remarks on Files/Filenames
Rename, Delete and Copy should work on Filenames rather than File plus
Filename. These procedures are almost always called without the need
to open the file. Opening the file may be expensive for buffered
files. To do a Open -> Rename -> Close sequence to change a file's
name is certainly annoying.
> (* read max LEN(b) CHAR's. 'howmany' indicates how many CHAR's are really read. *)
> PROCEDURE (r: Reader) ReadString(VAR str: ARRAY OF CHAR; VAR howmany: LONGINT);
This spec may lead to values in `str' that aren't terminated and
cannot be manipulated with any of the Strings procedures. What is the
benefit of this proc compared to `ReadBytes' anyway?
> BinReaderDesc = RECORD
> PROCEDURE (r: BinaryReader) ReadBool(VAR b: BOOLEAN);
> PROCEDURE (r: BinaryReader) ReadSet (VAR s: SET);
> END;
Those two procs only appear in BinReader/Writer. I don't see any
reason why we can't spend those types a textual representation and add
them to TextReader/Writer, too.
A GetDate procedure is missing. Input: file name. Output: time value
plus error code. How do we represent a time? For Unix a time value
is a record with a seconds and a microseconds field, both LONGINT.
Anyone got a better idea?
Some sort of test for file existence is necessary. Input: file name.
Output: TRUE/FALSE flag plus error code. The error code is necessary
with Unix, e.g. whenever the user has no permission to access a
directory on the file path. Result should be TRUE if there exists
something at the given location, even if it isn't a file (a directory,
a pipe, etc) or if the file exists but isn't accessible at all due to
lacking permissions.
A copy procedure would also be nice. Input: source and destination
file name. Ouput: error code.
The OpenReader/Writer procedures should probably be type-bound procedures.
Filenames: I'm missing any way to represent directories different than
strings. Maybe it would pay of to split a file name into a directory
locator plus file name/extension. A system-independent facility to
get a directory's file listing would also be nice. But I don't now if
this is feasible at all.
Just my two cents for now. I hope that Files and Filenames will be
intgrated into a more general class hierachy based on locators and
channels.
-- mva