The Right Approach to Exceptions

Jonathan M Davis jmdavisProg at gmx.com
Sun Feb 19 01:26:34 PST 2012


On Sunday, February 19, 2012 19:00:20 Daniel Murphy wrote:
> I wasn't really serious about implicit fallthrough.

Lately, it seems like I can never tell whether anyone's being serious or not 
online. :)

> Out of the syntaxes I could come up with:
> catch(Ex1, Ex2 e)
> catch(e : Ex1, Ex2)
> catch(Ex1 | Ex2 e) // java 7 syntax, horrible
> 
> I like (e : list) the best.  Naturally it would also accept a type tuple of
> exceptions.
> 
> http://d.puremagic.com/issues/show_bug.cgi?id=7540

LOL. Personally, I actually think that the Java 7 syntax looks great (I'd 
never seen it before), but catch(e : Ex1, Ex2) is just as good and more 
consistent with the language as a whole, since it doesn't try to give any 
operators a new meaning (as Java's does).

- Jonathan M Davis


More information about the Digitalmars-d mailing list