[phobos] Why ConvError and not ConvException?

Shin Fujishiro rsinfu at gmail.com
Tue Nov 16 14:45:39 PST 2010


Jonathan M Davis <jmdavisProg at gmx.com> wrote:
> On Tuesday 16 November 2010 12:41:29 Shin Fujishiro wrote:
> > By the way, it feels redundant for me to name every exception class
> > with an ending Exception, especially descriptive ones such as
> > ConvOverflowException.  Couldn't it be ConversionOverflow?
> 
> It's clearer and more consistent to have Exception in the name. It makes it nice 
> and obvious that you're dealing with an exception type, and it's not like youe 
> have to type them very often anyway. Also, what would you do for stuff like 
> std.datetime? It has DateTimeException. It's not like you can change it to 
> DateTime. Not only would that be a bad name (since its name is not indicative of 
> an exception or error at all), but there's already a separate DateTime type.
> 
> FWIW, all of the exceptions in Java have Exception in their name, and as far as 
> I recall, every exception class that I've used in any other language has had 
> Exception or exception in its name. It makes it nice and clear that you're 
> dealing with an exception type, and while some might be able leave it out - like 
> ConversionOverflow - that leads to inconsistency with all of the exception types 
> which need it in order to make it clear that they're actually an error of some 
> sort.
> 
> So, I definitely think that in Phobos and Druntime we should have Exception as 
> the suffix for all Throwables descended from Exception and Error as the suffix for 
> all Throwables descended from Error. It's clear and consistent that way.

Yeah, I agree that suffixed Exceptions are very clear.  I wrote it
because std.concurrency has non-suffixed exceptions such as
MessageMismatch, which are still clear thanks to negative terms
embedded in their names.


Shin


More information about the phobos mailing list