The Right Approach to Exceptions
Jacob Carlborg
doob at me.com
Sun Feb 19 07:07:27 PST 2012
On 2012-02-19 10:26, Jonathan M Davis wrote:
> 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
How is "catch(e : Ex1, Ex2)" consistent with the language? It's
completely backwards. catch-block are written as follows:
catch (Exception e) {}
Not
catch (e : Exception) {}
--
/Jacob Carlborg
More information about the Digitalmars-d
mailing list