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

Re: Problem with dribble



Bruno Haible wrote:
> Btw, do you feel that the second call to (dribble "dribble.log") should
> overwrite or append to the existing file?
There are several arguments why I think that it should append the file:
1. According to CLtL, dribble should simply redirect *standard-input* and *stan
dard-output*. When you have your screen assigned to *standar-output* you simply
 'append' output to the screen, but you don't clear the screen before every pri
nt. Similarly, dribble should not overwrite the previous information, but simpl
y append it.
2. It is simpler and safer to edit a dribble file and delete unwanted parts, ra
ther than trying to recover lost data because of careless re-dribbling..
3. Suppose that dribble does append the file, but you want to overwrite it:
 You would do: (dribble "dribble.log")
                 ....
               (dribble)
                 ...
               (delete-file "dribble.log")
               (dribble "dribble.log")

It is relatively simple and, actually, unlikely that someone would want to dele
te the dribble file without exiting Lisp and doing sthng. with it.
Now suppose that, on the other hand, dribble overwrites the file but you want t
o append the file. Yo need to do:
               (dribble "dribble.log")
                 ....
               (dribble)
                 ...
               (rename-file "dribble.log" <new-name>)
   At this point, if you are within a program or a loop, you might need to
   do some gensym'ing in order to create unique file names, and also some
   checking to make sure that the <new-name> does not exist.
               (dribble "dribble.log")

The conclusion is that this is much more cumbersome than the previous case, so
I would definitely vote for appending the file.
Regards, Leo