[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Questions about OPEN



    Date: Thu, 4 Oct 1984  22:33 EDT
    From: Rob MacLachlan <RAM@CMU-CS-C.ARPA>

	Well, if it's constructive to flame about the file system
    interface at this point, then I will add that I agree the :direction
    :probe is silly.  I also believe that requiring all of the
    file/pathname functions to accept streams as arguments is silly.  It
    seems to me that this symbol/namestring/stream/pathname foolishness is
    a result of the confusion between streams and pathnames and strings
    and symbols that is present in earlier lisps because they lack some of
    the above.

Not exactly.  Many of these functions, when applied to a stream, do something
slightly different than when applied to a pathname.  Specifically, they
operate on the exact file to which the stream is attached, which may not be
the same file as the one you would get if you used the name by which the
stream was opened (someone may have renamed something in the meantime, a new
version of the file may have been created in the meantime, or the file to
which the stream is attached may not be accessible any other way [in some
file systems] because it is a newly-created output file, for example).

This is an example of message-passing / generic-functions / object-oriented
programming sneaking into Common Lisp in the guise of ordinary functions.
I don't think that's bad.  Historically I/O -is- where it tends to strike first.

	I think that it is totally silly to suggest that these operations
    work on closed streams, since a closed stream can have no semantics
    other than possibly its name, which could be better represented by a
    pathname.  

Ours have slightly more semantics than that; they have a property list
of certain properties of the file that they used to be connected to when
they were open.  The main reason for this is what I mentioned before
about some file systems not knowing the truename (among other properties)
of an output file until it is closed.

	       If we really want to do this sort of thing, then we should
    define a File-Stream-Name function that returns the pathname
    associated with a file stream so that people can get the name from a
    stream.

Isn't that what the pathname and truename functions do, when applied to
a stream?  (There are two possible pathnames you could want from a stream,
the one it was opened with and the one it is actually connected to).

    My opinon may be slightly biased by the lack of any concept of an open
    file in the Sesame filesystem that underlies Spice Lisp.

One example of the enormous diversity of file systems that we are trying
to squeeze into a single model so we can write portable programs.

I do think that :direction :probe should be flushed, on the grounds that it
is exposing an implementation-dependent mechanism and that the portable
aspects of it are already available through probe-file.  I also think that
not all of Symbolics' experience in dealing with incompatible file systems
in a generic way was distilled into the writeup in the Common Lisp manual,
and a future second edition should incorporate more of that as well as
other people's experiences, to make user's file-processing programs more
likely to be truly portable.