| Re: Requested change to "SAVE" procedure [message #82920 is a reply to message #82870] |
Thu, 24 January 2013 08:08   |
Paul Van Delst[1]
Messages: 1157 Registered: April 2002
|
Senior Member |
|
|
Hello,
On 01/23/13 12:33, Matthew wrote:
>> If "accidental" overwrites are that big of an issues for you, how
>> come you are not checking that the file exists before you try to
>> create it -- and thus clobber existing ones?
>
> The SAVE command works without any arguments. If SAVE is called
> without arguments, I would assume that the user wants a new file, not
> to overwrite existing files. In this case, a '-001' appended to the
> filename seems like the right move. Either that, or make FILENAME
> required.
Huh. My assumption would be that, if called without any argument, then
the user isn't concerned with details like "does the file exist?". They
just want to SAVE the variables. By not specifying the path+filename
explicitly, the user is effectively telling IDL that where and into
which file variables get saved is not an issue.
If that is not the case (say, late at night :o) then the user should be
explicit about the filename.
I'm also not a big fan of stuff like appending "version numbers" onto
files. It seems an unnecessary complication and (based purely on my
personal experience) once the next morning arrives those version numbers
are meaningless (I have a pretty crappy memory I guess :o)
> If SAVE is called with the FILENAME keyword, then clobbering should
> take place. It is definitely the user's fault this time.
If it's the same (default) filename, then yes.
> My two cents...
I guess in the end it comes down to what people think is a reasonable
default behaviour. My programming education started with Fortran so the
IDL behaviour in this case makes perfect sense.
Maybe the SAVE procedure should be changed to make the filename argument
mandatory? That sounds like a reasonable compromise (at the expense of
breaking older codes).
cheers,
paulv
|
|
|
|