On 19.07.2012, at 22:22, Julian Reschke wrote:

> On 2012-07-19 21:47, Alexander Klimetschek wrote:
>> On 12.06.2012, at 15:01, Julian Reschke wrote:
>> 
>>> Is this just to avoid catching exceptions? (keep in mind that the
>>> exception might be thrown anyway...)
>> 
>> No, if hasProperty() returns true, you don't expect the PathNotFoundEx and 
>> don't have to handle it for the purpose of semantics! There is no 
>> catch(PathNotFoundEx) in the code you quote :-)
> 
> Except for race conditions.

Yes, but that's a separate issue (atomic behavior). Any write operation based 
on that will be a separate call anyway.

IMHO such application-level semantics (does exist vs. does not exist) should 
not be handled by exceptions. Simply because it is not what exceptions are 
designed for (exceptions), when the normal application logic expects this case. 
try/catch for normal logic is confusing.

Cheers,
Alex

Reply via email to