On 12 Dec 99, at 14:10, David James wrote:
So how should one 'close' a file in EP - would that be 'unbind'?
"unbind" will undefine the file variable, so that it may not be used in subsequent file access calls (e.g., a read or write), as will allowing the file variable to go out of scope. However, I don't see anything in the standard that requires the external file to be closed at that point. That is, an EP program may unbind a file variable, then pause, and I don't see anything in the standard that requires that the external file be closed at the time of the pause, or to have its data flushed, etc. It *may*, of course, and that's may be the logical place to physically close the file, but that's left up to the implementation.
(6.7.5.2, "File Handling Procedures," says, "These activities [i.e., the procedures], and the point at which they are actually performed, shall be implementation-defined.")
I think that the idea is to divorce the abstract behavior of files in the EP program from the physical implementation, such that the programmer doesn't worry about whether the file is physically open or not, but simply whether the file variable is defined and bound to some external entity.
I think you have an extraneous word there - it's the "nearly" :-)
Agreed fully! I have a printed copy of the standard, and when trying to decipher a particularly obtuse passage, I sometimes wish I was blessed with twenty fingers to bookmark all of the various defined terms that appear in the given section.
-- Dave