March 11, 2013
On Monday, 11 March 2013 at 03:46:22 UTC, Ali Çehreli wrote:
> On 03/10/2013 08:10 PM, Rob T wrote:
> >>>
> >>> Lippincott functions avoid macros and make it more explicit
> that the
> >>> entire body is inside a try block.
> >>>
> >>> Ali
> >>
> >
> > Oops, I think you were showing me an example where it could
> be used.
>
> Yes but we still use the macros! The macros were written ten years ago but I learned about this idiom two months ago. :)
>
> Ali

Ouch, 10 years too late, but I bet you are looking forward to using it in your new code.

I was stuck with macros similar to that for a few years. It was unbearable because at times I had custom operations to perform within a catch, but the macros had various levels of standard error logging and reporting, so deciphering the macros and inserting new operations was not fun and defeated the purpose making it very difficult to maintain. Even more macros appeared to try and deal with it. When we started building a new library, I searched in desperation for a better solution and luckily stumbled on the one that used the rethrow, what a relief! Unfortunately the old code still needs to be maintained for several more years.

Unlike in C++ we only have to worry about catching Throwable and objects derived from it, so things are much better off simply because of that. I always thought it to be silly to allow anything to be thrown because you'd never be able to know what to catch unless you had complete trust in the code. When I first looked at D it was improvements like this that had me very eager to try it out.

Anyway, thanks for your input, much appreciated!

PS: Your D Programming Tutorial is excellent, many thanks! You may want to add a note about the Lippincott idiom in there.

--rt
1 2 3 4 5
Next ›   Last »