February 09, 2006 Re: Tim Sweeney on Next Programming Language | ||||
---|---|---|---|---|
| ||||
Posted in reply to Unknown W. Brackets | Unknown W. Brackets wrote: > > If my library segfaults, or gets an access violation, or whatever... Apache dies. Say goodbye to my program, and possibly my job if it results in a lot of downtime. Boy, that's a dangerous thing, those "useful access violations"... > > Luckily, I haven't had that many run-ins with this problem. Still, if it were to happen, I would most certainly want an exception thrown - I had thought - which could then be caught, and handled gracefully (read: show the user a 500 Internal Server Error message, not die and give them nothing.) After all, a null pointer doesn't necessarily mean the server blew up. Maybe it could even send me an email to set me straight. > But in D, the Access Violations are Exceptions, and you can catch them. This post had made me think otherwise, when I first read it, but today I checked it. -- Bruno Medeiros - CS/E student "Certain aspects of D are a pathway to many abilities some consider to be... unnatural." |
February 09, 2006 Re: Tim Sweeney on Next Programming Language | ||||
---|---|---|---|---|
| ||||
Posted in reply to Bruno Medeiros | Bruno Medeiros wrote:
> But in D, the Access Violations are Exceptions, and you can catch them.
On Windows, that is...
--anders
|
February 09, 2006 Re: Tim Sweeney on Next Programming Language | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter Bright | Bruno Medeiros wrote: > Derek Parnell wrote: >> >> So with the current D, one does get null pointer dereference checking; >> its >> just that it looks like an access violation instead. So maybe we can >> plead, >> cajole, whatever to make Walter give us a more meaningful message when an >> access violation is the result of a NULL pointer (file name and line >> number >> would be a bloody big help too). >> > If this should be made, and I too agree it should, it should work in the > form of throwing an exception, as was also was noted. > This is in error. Under Unknown W. Brackets assumption I thought that access violations didn't throw Exceptions but they do. Someone should have corrected us. Walter Bright wrote: > "Bruno Medeiros" <daiphoenixNO@SPAMlycos.com> wrote in message news:dscnvs$1eb4$1@digitaldaemon.com... >> I wonder how that other fellow (shinichiro) implemented the stack trace. > > I took a brief look at it. What he did was intercept the exception generated by the operating system, then used the Microsoft debug interface to read the debug data in the executable to associate a file/line number with it. > > It is the same thing that a debugger does, and so it relies on the executable being compiled with -g (full debug info). > > To implement this requires a pretty advanced technical knowledge of how Windows SEH works, and shinichiro deserves a lot of respect for figuring this out, since it's mostly undocumented. > > The code is highly Windows dependent, and none of it is useful under Linux. But the equivalent could presumably be done on Linux given someone who knows how debuggers work under Linux. > > Based on this new perspective, I now agree that a stack trace is not a prioritary feature. It would require non-trivial code, and different implementations for each platform, and it's quite some work. But still, we could have line numbers for explicitly thrown exceptions, as that is quite easy to implement. Since throw is a static construct, it is known at compile the line and file were it occurs (similarly to assert), and so it could add such info to the thrown Exception. > To implement this requires a pretty advanced technical knowledge of how > Windows SEH works, and shinichiro deserves a lot of respect for figuring > this out, since it's mostly undocumented. > Still, you, as a compiler writer, already know how it(SEH) works, right? -- Bruno Medeiros - CS/E student "Certain aspects of D are a pathway to many abilities some consider to be... unnatural." |
February 09, 2006 Re: Tim Sweeney on Next Programming Language | ||||
---|---|---|---|---|
| ||||
Posted in reply to Bruno Medeiros | Bruno Medeiros wrote: > > If this should be made, and I too agree it should, it should work in the > > form of throwing an exception, as was also was noted. > > This is in error. Under Unknown W. Brackets assumption I thought that access violations didn't throw Exceptions but they do. Someone should have corrected us. They only throw exceptions with DMD/Win, and in fact it seems that you *lose* some valuable information because of that... ? (which might have been rectified somewhat by the new patch, but) Some info on how it looks on other platforms can be found in: http://www.digitalmars.com/d/archives/digitalmars/D/14342.html In fact, it also looks similar on Windows when using GDC/MinGW: Program received signal SIGSEGV, Segmentation fault. 0x00401290 in _Dmain () at null.d:4 4 o.toString(); (gdb) bt #0 0x00401290 in _Dmain () at null.d:4 #1 0x004013b9 in _d_run_main (argc=1, argv=0x3d2448, main_func=0x401280 <_Dmain>) at ../../../libphobos/internal/dgccmain2.d:81 #2 0x004012e3 in main (argc=1, argv=0x3d2448) at ../../../libphobos/internal/cmain.d:5 (gdb) This was when running "null.exe" with gdb.exe, on Windows XP. Walter has said that the signals "should" (i.e. eventually) be converted into D exceptions on the other platforms too, but I'm not all that sure if that's such a great idea... ? If there's such an exception, it should at least have all info. --anders |
February 09, 2006 Re: Tim Sweeney on Next Programming Language | ||||
---|---|---|---|---|
| ||||
Posted in reply to Anders F Björklund | Anders F Björklund wrote: > Bruno Medeiros wrote: > >> > If this should be made, and I too agree it should, it should work in the >> > form of throwing an exception, as was also was noted. >> >> This is in error. Under Unknown W. Brackets assumption I thought that access violations didn't throw Exceptions but they do. Someone should have corrected us. > > They only throw exceptions with DMD/Win, and in fact it seems > that you *lose* some valuable information because of that... ? > (which might have been rectified somewhat by the new patch, but) > Yikes. Didn't know about that one, that clears up things. > Some info on how it looks on other platforms can be found in: > http://www.digitalmars.com/d/archives/digitalmars/D/14342.html > In fact, it also looks similar on Windows when using GDC/MinGW: > Thanks for the info on that thread. > Walter has said that the signals "should" (i.e. eventually) > be converted into D exceptions on the other platforms too, > but I'm not all that sure if that's such a great idea... ? > Why not? Afraid that one won't get all the information when debugging with gdb as one gets now? -- Bruno Medeiros - CS/E student "Certain aspects of D are a pathway to many abilities some consider to be... unnatural." |
February 09, 2006 Re: Tim Sweeney on Next Programming Language | ||||
---|---|---|---|---|
| ||||
Posted in reply to Bruno Medeiros | Bruno Medeiros wrote:
>> Walter has said that the signals "should" (i.e. eventually)
>> be converted into D exceptions on the other platforms too,
>> but I'm not all that sure if that's such a great idea... ?
>>
> Why not? Afraid that one won't get all the information when debugging with gdb as one gets now?
Yes. (Just get a generic runtime error, with some basic message)
I'm not chronically against the idea, if it works OK as in Java ?
Just that if it can't be all the way, might as well be as in C...
--anders
PS.
This is somewhat similar to how string literals are writable in
DMD/Win, but how they cause access violations in other setups...
"Implementation Defined"
|
February 10, 2006 Re: Tim Sweeney on Next Programming Language | ||||
---|---|---|---|---|
| ||||
Posted in reply to Mike Parker | This discussion came up in gamedev.net too. D was mentioned but sort of blown off. Here's a few of the comments ... "D isn't much different from C++ therefore suffer the same problems/issues, there fundamentally imperative languages" "Also, the "key" feature here, IMO, is STM. It really is the first concurrency abstraction to come around (ever) which is really useful. And it only came around in Nov 2004 (and AFIK it's only available in Haskell at the moment). "I don't think it can be solved with a design pattern in an existing language." And yes there are concurrent OO design patterns but that means very little here, it doesn't help/change the fact that most numerical computations are purely functional and in some places you may need to do state-full computation locally. It' s not going to change the fact that the way we keep going with inappropriate tools there will be to much shared mutable state flying around for reliable, maintainable, correct & clean concurrent code written by a medium to large team of developers who want to be productive." http://www.gamedev.net/community/forums/topic.asp?topic_id=373751 (page 2, towards the bottom) |
February 11, 2006 Re: Tim Sweeney on Next Programming Language | ||||
---|---|---|---|---|
| ||||
Posted in reply to Anders F Björklund | Anders F Björklund wrote: > Bruno Medeiros wrote: > >>> Walter has said that the signals "should" (i.e. eventually) >>> be converted into D exceptions on the other platforms too, >>> but I'm not all that sure if that's such a great idea... ? >>> >> Why not? Afraid that one won't get all the information when debugging with gdb as one gets now? > > Yes. (Just get a generic runtime error, with some basic message) > > I'm not chronically against the idea, if it works OK as in Java ? > Just that if it can't be all the way, might as well be as in C... > > --anders > > PS. > This is somewhat similar to how string literals are writable in > DMD/Win, but how they cause access violations in other setups... > > "Implementation Defined" Yes, loosing such functionality wouldn't be nice. However, there should some workaround/fix. For example, one can put a breakpoint in the D runtime code that would handle the access violations (where the exception is created and thrown), so that all the debug info would still be available? And could gdb be hacked/fixed/wraped so that this breakpoint setting is done automatically? -- Bruno Medeiros - CS/E student "Certain aspects of D are a pathway to many abilities some consider to be... unnatural." |
February 14, 2006 Re: Tim Sweeney on Next Programming Language | ||||
---|---|---|---|---|
| ||||
Posted in reply to Anders F Björklund | (on which you'd generally not run a webserver.)
-[Unknown]
> Bruno Medeiros wrote:
>
>> But in D, the Access Violations are Exceptions, and you can catch them.
>
> On Windows, that is...
>
> --anders
|
Copyright © 1999-2021 by the D Language Foundation