DIP65: Fixing Exception Handling Syntax

David Nadlinger via Digitalmars-d digitalmars-d at puremagic.com
Fri Jul 25 15:56:21 PDT 2014


On Friday, 25 July 2014 at 21:34:22 UTC, Walter Bright wrote:
> On 7/25/2014 2:53 AM, Jakob Ovrum wrote:
>> On Friday, 25 July 2014 at 09:39:23 UTC, Walter Bright wrote:
>>> That can be special cased, too.
>>
>> Seriously? Where does it end?
>>
>> catch(MyTemplatedException!true) {
>> }
>
> That one can't be special cased in the parser.
>
>
>> Parsing this as a proper type without a trailing identifier is 
>> a nice feature
>> that a lot of people use, unlike the ghastly catch {} feature 
>> that nobody uses
>> and should be considered harmful. Whether we constrain the 
>> former or kill the
>> latter, they're both breaking changes. So why are we favouring 
>> the *bad* one?
>
> Because it breaks the least amount of code.

I hope you are running head first into a usability disaster here. 
 From a user's perspective, MyTemplatedException!true is a type 
just like MyException is and there is no reason why it should 
work differently. Remember built-in types and alias parameters?

Let's just get rid of "catch {}" which encourages unsafe code and 
be done with it.

David


More information about the Digitalmars-d mailing list