I'm new to the Saga list and have started to look over the java code and various docs. I'm wondering if the exception AlreadyExists might be eliminated from the SAGA spec, in favor of different behavior -- namely to do nothing in the case where AlreadyExists would normally be thrown. This should be reasonable for mkdir(), adding a context, etc. I believe this would be simpler and nicer for users. Cheers, Steve
There is a single case where we can't remove it (well, I found that one only at least): opening a file with with the flags (Create | Excl). That MUST raise an error, otherwise the flag would make no sense. As for mkdir, we tried to stay close to what users know from command line, and from POSIX/libc, which both return an error if the dir exists. As for contexts: I think it makes sense to allow a context to get added twice, and to silently ignore the second call. The last usage of AlreadyExists is for adding locations to a logical file. It would probably make sense to keep that similar to adding contexts to a session - its semantically close. Cheers, Andre. Quoting [sbrandt@cct.lsu.edu] (Jun 22 2006):
Date: Thu, 22 Jun 2006 10:43:25 -0500 From: sbrandt@cct.lsu.edu To: SAGA RG
Subject: [saga-rg] AlreadyExists I'm new to the Saga list and have started to look over the java code and various docs.
I'm wondering if the exception AlreadyExists might be eliminated from the SAGA spec, in favor of different behavior -- namely to do nothing in the case where AlreadyExists would normally be thrown. This should be reasonable for mkdir(), adding a context, etc.
I believe this would be simpler and nicer for users.
Cheers, Steve
-- "So much time, so little to do..." -- Garfield
Quoting Andre Merzky
There is a single case where we can't remove it (well, I found that one only at least): opening a file with with the flags (Create | Excl). That MUST raise an error, otherwise the flag would make no sense.
Yes, but if it really is the only place then maybe this is really a WriteError, or some subclass thereof. BTW, are the names of these exceptions still debatable? Because having the name "Error" in a Java exception that is not a subclass of Error is awkward. It would be nicer if we could call it something else like "WriteException".
As for mkdir, we tried to stay close to what users know from command line, and from POSIX/libc, which both return an error if the dir exists.
I think it depends. One could argue that if we want to mimic POSIX/libc then this should show up as a return code and not an exception. Posix does not force you to clutter your code with handling this case every time you call mkdir(). I could see throwing an exception of some sort if, at the conslusion of the call to mkdir(), the directory did not exist. Cheers, Steve
Quoting [sbrandt@cct.lsu.edu] (Jun 22 2006):
Quoting Andre Merzky
: There is a single case where we can't remove it (well, I found that one only at least): opening a file with with the flags (Create | Excl). That MUST raise an error, otherwise the flag would make no sense.
Yes, but if it really is the only place then maybe this is really a WriteError, or some subclass thereof.
BTW, are the names of these exceptions still debatable? Because having the name "Error" in a Java exception that is not a subclass of Error is awkward. It would be nicer if we could call it something else like "WriteException".
That should be up to the language binding I think. Other languages don't have exceptions at all (C), or totally different error reporting mechanisms (Perl). Important is IMHO that the semantics stays the same over the various language bindings, as far as possible...
As for mkdir, we tried to stay close to what users know from command line, and from POSIX/libc, which both return an error if the dir exists.
I think it depends. One could argue that if we want to mimic POSIX/libc then this should show up as a return code and not an exception. Posix does not force you to clutter your code with handling this case every time you call mkdir().
We tried to minimize the number of return codes though, but you have a good point here I think. However, the same argument should then be applied to all methods - right now only a few methods indicate error conditions via return values (read/write beeing a notable example). Andre.
I could see throwing an exception of some sort if, at the conslusion of the call to mkdir(), the directory did not exist.
Cheers, Steve
-- "So much time, so little to do..." -- Garfield
participants (2)
-
Andre Merzky
-
sbrandt@cct.lsu.edu