The Right Approach to Exceptions
a at a.a
Sun Feb 19 11:27:00 PST 2012
"Andrei Alexandrescu" <SeeWebsiteForEmail at erdani.org> wrote in message
news:jhr67g$2dup$4 at digitalmars.com...
> The Java7 syntax looks meaningful to me, too - you want to catch the union
> type. A possibility that wouldn't change the language for us would be to
> catch Algebraic!(Ex1, Ex2).
I'd argue that a templated catch block would be better so you wouldn't have
to query what type it is in order to use it:
// With a little compler magic:
catch(TypeTuple!(Ex1, Ex2) e)
writeln(e.msg); // Look ma, no querying!
// Mimicking D1-style template contraints:
catch(E : Ex1, Ex2)(E e)
More information about the Digitalmars-d