Conclusions of the exception discussion
Martin Nowak
dawg at dawgfoto.de
Sat Feb 25 04:35:18 PST 2012
> 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.
The exception types (E1, E2, E3) should expand TypeTuples similar to how
you
declare base classes.
alias TypeTuple!(SocketTimeOut, SocketFooBar) SocketExceptions;
try
{
bind(...);
listen(...);
}
catch (IOException io : SocketExceptions)
{
}
As for the syntax how about '=' assigning a catched exception.
catch(IOException io = E1, E2, E3)
catch(auto io = E1, E2, 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)
More information about the Digitalmars-d
mailing list