bearophile wrote: > Maybe exceptions nature should be changed a little so they store > __FILE__ and __LINE__ on default (exceptions without this > information are kept on request, for optimization purposes).
I'd like that. Even with a stack trace, it's nice to have that available right at the top. A while ago, someone posted a stack tracer printer for Linux to the newsgroup. Using that, this program: void main() { throw new Exception("test"); } dmd test60 -debug -g backtrace.d Prints: object.Exception: test ---------------- ./test60(_Dmain+0x30) [0x807a5e8] ./test60(extern (C) int rt.dmain2.main(int, char**) . void runMain()+0x1a) [0x807d566] ./test60(extern (C) int rt.dmain2.main(int, char**) . void tryExec(void delegate())+0x24) [0x807d4c0] ./test60(extern (C) int rt.dmain2.main(int, char**) . void runAll()+0x32) [0x807d5aa] ./test60(extern (C) int rt.dmain2.main(int, char**) . void tryExec(void delegate())+0x24) [0x807d4c0] ./test60(main+0x96) [0x807d466] /lib/libc.so.6(__libc_start_main+0xe6) [0xf75a5b86] ./test60() [0x807a4e1] No line or file info! I'd really like to have something there. Though, actually, whether it's in the message or in the stack trace doesn't really matter. As long as it's there somewhere. Most my custom exceptions use default params in their constructor to add it. Perhaps the base Exception should too?