From: Keith Burton (kb_at_[hidden])
Date: 2002-08-04 02:04:42


The conversation on this subject appears to be revolving around the
implementation and not the specification.
 
In my opinion , remove should be idempotent and therefore the
specification ( but not the implementation ) should be :
 
 
if ( exists( ph ) )
{
    if ( is_directory( ph ) && ! empty( ph ) )
        throw
    else
        os::remove( ph )
}
if ( exists( ph ) )
    throw
 
 
where exists( ph ) is specified as :
 
if ph definitely exists
    return true ;
else if ph definitely does not exist
    return false ;
else
    throw ;
 
 
This is a valid specification which meets all the objections about
wanting to be sure that the file has been deleted while still meeting
the ease of use criteria that I believe is important for a portable
filesystem. I accept that it may not be possible to efficiently
implement this specification on any particular operating system.
 
 
Keith Burton