On Friday, 8 March 2013 at 18:49:53 UTC, Jonathan M Davis wrote:
Except that the C++ one is just as pointless. In both cases, you're telling it to catch everything. It's just that syntax is slightly different, because D doesn't allow you to throw without an explicit variable. And it's only a handful of characters difference in length. So, to some of us at least, it seems like you're blowing things out of proportion. And given the lack of clarity in the C++ solution, it comes off as being worse from a technical
perspective, regardless of the typing involved.

- Jonathan M Davis

I don't wish to blow things out of proportion, and will say again that the main objective I was trying to achieve has been met, thanks to the assistance I received in here, so this remaining item is not all that major, it's just an unnecessary repetitive nuisance to me.

From a technical stand point, I'm implementing a reusable exception handler or dispatcher (I've seen these two terms used to describe it) which is extremely useful to me, and I would assume to many others. There are examples of this concept implemented in C++ by other programmers, that's how I got the idea.

Before I started using an exception handler, my exception handling was very limited and tedious to implement, and I never saw a need to re-throw an exception. There may be other uses for rethrow that I'm not aware of.

What my C++ exception handler does not require, is the exception reference passed in as an argument, so that's one of the main differences between what D allows and what C++ allows. In my case every catch statement and function call will be identical, it's slightly more tedious to type in than the C++ version. No big deal for you, but it is annoying for me because I use this form very frequently.

If you know of a better way to implement an exception handler in D, then I'd like to know about it. For example I do know that D's system allows you to insert callback functions, but I don't yet know how to make use out of it, so perhaps there's a better way.

Any further help or insight on this matter is appreciated.

--rt

Reply via email to