[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
- To: common-lisp@SU-AI.ARPA
- Subject: Re: file-length
- From: Charles Hedrick <HEDRICK@RUTGERS.ARPA>
- Date: Fri, 08 Mar 1985 18:39:00 -0000
- In-reply-to: Message from ""Scott E. Fahlman" <Fahlman@CMU-CS-C.ARPA>" of 7 Mar 85 23:25:00 EST
Tops-20 requires a GTJFN before we can find file length. But we can
certainly implement it by opening the file temporarily inside
file-length. So you shouldn't stop just because some OS's may
need to open the file.
However you should consider that this may lead to ambiguity because of
version numbers. Consider the following code sequences:
The problem with both of these is that some other program may create
a new version of foo.bar in the interim. If we say that you can
look at attributes only for an open stream, then people are more
likely to open the file once, and do their I/O and attribute-checking
on the open stream. On TOPS-20, we could get the same effect by
encouraging people to do TRUE-NAME the first time they refer to a
file. Then they can be sure they are always talking about the same
one. But on Unix this wouldn't work.
So the safest thing is probably to keep the current definition.
If somebody really does want to look at the length of a file and
will never be opening it, you can define a macro to allow a
(with-temporarily-open-file "foo.bar" x (file-length x))