Andrei Alexandrescu Wrote:

> On 2/18/12 4:26 PM, Jonathan M Davis wrote (abridged):
> GetOptException
> FlagArgumentMissingException
> InvalidFlagArgumentException
> UnknownFlagException
> FileException
> FileNotFoundException
> NotFileException
> NotDirException
> AccessDeniedException
> 
> I died inside a little.
> 
> Andrei
> 

As a lurker watching this debate with interest I just had an idea out of the 
blue idea that may or may not have value but might reduce the desire to create 
a new exception type Exception type for every error. 

What if the catch syntax was extended to take both a type and a condition.  

try {
  write(filename, ...);
}
catch(FileException e; e.errno == EEXIST) {
}
catch(FileException e; e.errno == EROFS) {
}

I realize that this is just syntactic sugar for catch(...) { if(...) {}} feel 
free to shoot it down.


Reply via email to