IMHO the reasonable default if a program crashes due to a completely unexpected exception is for the stack trace to be printed. Therefore, yes, toString should add the stack trace.<br><br><div class="gmail_quote">On Wed, Apr 7, 2010 at 12:36 PM, Sean Kelly <span dir="ltr"><<a href="mailto:sean@invisibleduck.org">sean@invisibleduck.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">Related question: should toString add the stack trace or not?<br>
<div><div></div><div class="h5"><br>
On Apr 7, 2010, at 8:39 AM, Andrei Alexandrescu wrote:<br>
<br>
> At what point do you need to print exceptions in runtime? Is that if an exception leaves main()?<br>
><br>
> Andrei<br>
><br>
> On 04/07/2010 10:29 AM, Sean Kelly wrote:<br>
>> The runtime can do one of two things: print exceptions according to a standard format and inject the msg field in the proper place or it can call toString. Which should be done? I prefer the former because it makes for a standard presentation and doesn't risk allocating memory needlessly, but I can see how people might do fancy stuff in toString that they expect to be used instead. This came up because I'm adding a default stack trace handler, and the current behavior prints the stack trace twice, so something needs to change.<br>
>> _______________________________________________<br>
>> phobos mailing list<br>
>> <a href="mailto:phobos@puremagic.com">phobos@puremagic.com</a><br>
>> <a href="http://lists.puremagic.com/mailman/listinfo/phobos" target="_blank">http://lists.puremagic.com/mailman/listinfo/phobos</a><br>
<br>
_______________________________________________<br>
phobos mailing list<br>
<a href="mailto:phobos@puremagic.com">phobos@puremagic.com</a><br>
<a href="http://lists.puremagic.com/mailman/listinfo/phobos" target="_blank">http://lists.puremagic.com/mailman/listinfo/phobos</a><br>
</div></div></blockquote></div><br>