On Sunday, 9 February 2014 at 05:00:15 UTC, Marco Leise wrote:
And static allocation isn't an exactly appealing option...

  throw staticException ? staticException : (staticException =
  new SomethingException("Don't do this at home kids!"));

and practically out of question when you need to chain
exceptions and your call stack could contain this line of code
more than once, resulting in infinite loops in exception
chains as a new bug type in D, that is fixed by writing:

  catch (Exception e) {
throw (staticException ? (e.linksTo(staticException) ? staticException.dupThenWrap(e) : staticException) : (staticException = new SomethingException("Don't do this at home kids!"));
  }

This doesn't seem like a valid concern. Nothing stops you from
using a (standard) function to do that ugly boilerplate.

Reply via email to