Suggestion: Syntactic sugar for Exception handling in D2

Michiel Helvensteijn m.helvensteijn.remove at gmail.com
Mon Jun 22 03:26:39 PDT 2009


Daniel Keep wrote:

>>> I like the idea from a DRY perspective.
>> 
>> How so? I don't see anything 'repeated' in the before-case.
> 
> The 'try' keyword is redundant.  The presence of any number of catches
> or a finally indicates that the block must trap exceptions.  If there
> are no catches or a finally, then a try by itself would be pointless.

Ah yes. So the intention to trap exceptions is repeated. If there were no
longer any exceptions to worry about, you would have to remove the "try"
keyword as well as the "catch" clauses.

I hadn't considered the DRY abbreviation to fit there, but now I see how it
could. A bit obscurely, I guess, but still validly.

-- 
Michiel Helvensteijn




More information about the Digitalmars-d mailing list