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

What should CLOSE return? Closed-channel-object, or truefilename.



> !section  21.3(7)   Nick Gall 85-03-19
> !version  Digital Press 1984
> !topic    What does CLOSE Return?
> 
> I think it should return the STREAM it was given to close.  This
> would make it symmetric with OPEN: OPEN returns an open stream,
> CLOSE returns a closed stream.

That's not symmetric, that's coercive. OPEN and CLOSE are like
matching parenthesis, one does it and the other undos it except for
a residual side-effect. OPEN takes a name and returns an I/O channel
(at the LISP level, an object that can be name an active stream of
data). CLOSE takes an I/O channel and should return a name to be
symmetric with OPEN. This would be an opportune time to solve race
conditions where several users are making different versions of the
same file at the same time by the trick of writing a temporary file
and then renaming it during the CLOSE. At CLOSE the version number is
determined, and at that moment before somebody can create a later
version the lisp CLOSE function obtains the true filename of the
particular version we created.