Le 2010-07-30 à 11:52, Andrei Alexandrescu a écrit : > Steve Schveighoffer wrote: >> If you want to avoid printing stack traces, catch the exception inside of >> main. I don't think it's too much to ask. > > That argument goes both ways, i.e. I could tell you it's not much to ask to > insert a try/catch if you care about the stack trace.
Calling abort() before unwinding the stack also has the advantage that if you have a debugger hooked it'll stop you right there and you'll have the full state of the program available at the moment the exception was thrown *before* unwinding the stack. > D should be script-friendly, it's a huge boon and a huge appeal, That's true. > and stack traces don't go with script friendliness. I disagree. Stack traces can be useful when debugging a script. Imagine your 10-line script uses a library that has a bug in it, and all you get is the message from an exception thrown by a function from another library used by that first library. Without a stack trace you're totally lost. If you want to throw error messages to the user using the exception mechanism, then there could be a special exception class for that. But normal exceptions aren't things that should be seen by the user; and if the user sees them he'll probably seek your help and the first thing you'll want is to know in what context the exception was thrown: a stack trace and if necessary a debugger stopped right where it happened. -- Michel Fortin [email protected] http://michelf.com/ _______________________________________________ phobos mailing list [email protected] http://lists.puremagic.com/mailman/listinfo/phobos
