"Martin Nowak" <[email protected]> wrote in message 
news:[email protected]...
>> It's currently 'catch(auto e : E1, E2, E3)' but changing the syntax is
>> trivial if everyone decides they want it.
>>
> We should be consistent and allow to specify a type instead of auto.

That's a very good idea.

> The exception types (E1, E2, E3) should expand TypeTuples similar to how 
> you
> declare base classes.

Oops, I meant to do this and completely forgot.

> As for the syntax how about '=' assigning a catched exception.
> catch(IOException io = E1, E2, E3)
> catch(auto io = E1, E2, E3)
>

That syntax (sort of) already means declare variables io, E2 and E3.

> The colon is used for type conversions, where left implicitly converts to 
> right.
> catch(E1, E2, E3 : IOException io)
> catch(E1, E2, E3 : auto io)

And that looks like three template arguments, sorta...

The syntax I've implemented was 'inspired' by the base class list syntax. 
When base class protection is removed it could even use the same parsing 
function.  It's listing derived classes, not base classes, but this is the 
closest thing in D syntax I could find.
It also works with typetuples in the same way.

But anyway, I'll implement whatever gets W approval. 


Reply via email to