Re: crash_message
On Wed, 1 Sep 1999 15:57:23 -0500, Roderick Jackson <rjackson at CSIWEB.COM>
wrote:
>Cuny, David wrote:
>>> It *might* even be possible to satisfy David's
>>> needs, while avoiding the quagmire of a generic
>>> crash routine ...
>>
>>What quagmire?
>
>I know some of this has been hinted at before, but consider:
>
>What happens if your error routine contains an error? Should
>Euphoria then skip it and do a "standard" crash, or should
>there be a hiearchy of routines (a complicated feature in
>itself)?
I would be satisfied with Euphoria forgetting the first error and reporting
the error in my crash_routine, and continued with any unfinished
crash_routines before exiting with the error. Or ex.err could be written
with the first error, and append any further errors to it.
>Beyond that, what's to stop you from essentially
>re-running the program once your error-handling routine is
>given control? In other words, if the error can be trapped
>by any typical routine, without restrictions placed on it,
>you could very well "carry on" as if the error never happened,
>regardless of its severity.
I agree. There is no way to prevent programmers from abusing the mechanism.
>Basically, a unrestricted, generic error routine has powerful
>potential uses, but it also has all the elegance & structural
>integrity of a "goto" (I can already envision a flame or two
>from this one...)
No flames here, it is an evil goto, plain and simple. You could even use it
to make your program "crash-proof" (at the expense of an infinite loop.)
-----------------------------------------
procedure main()
? somevar / 0 -- do something stupid
end procedure
procedure crash_handler()
-- FYI message
puts(1, "got a error (heh heh)\n")
-- re-register the crash handler (assuming
-- it is removed before it is called)
crash_routine(routine_id("crash_handler"))
-- continue processing
main()
end procedure
-- register the crash handler for the first time
crash_routine(routine_id("crash_handler"))
main()
-----------------------------------------------
>That's not to say it shouldn't be implemented, just that it's
>likely to be a stumbling block if it were. Looking at Pete's
>situation with Linux keyboard handlers, I don't see any other
>way to allow a graceful recovery; there's obviously many ways
>to alter a system so that you'd need to undo the change before
>exiting (not everything could be assigned to a simple
>"parameter" like crash_graphics_mode().)
It would be absolutely essential to have the crash routine be able to do
anything necessary to restore the graphics mode, save data to a backup file,
or restore keyboard handlers. The crash routine must be able to access all
variables and call any other routines within scope.
>Perhaps "quagmire" is the wrong word. MHO is that the
>implementation you described (exit immediately upon a second
>crash), combined with other restrictions, would be the way to
>do it. I wouldn't like it conceptually, but considering the
>current state of error-handling under Euphoria, I admit that
>I wouldn't hesitate to use it.
>
>
>Rod
I guess to be implemented in Euphoria, it would have to be shown that it
would provide a greater potential for doing good than for doing evil. Even
Java with it's exception handing can't prevent programmers from squelching
unwanted exceptions with an empty catch block.
If any Euphoria programmer posts some code that abuses crash_routine, we all
could publicly shame them for their bad programming practice. If it is used
for ignoring errors in private/undistributed code, I say let them. Using a
crash routine to get around an error would probably require about as much
work as would to elimiate the cause of the error itself.
David Cuny has asked me before to add crash_routine to Peuphoria, now I just
might do it to see how it would actually work. Part of Peu's purpose is to
try out new things like that.
Later,
_______ ______ _______ ______
[ _ \[ _ ][ _ _ ][ _ ]
[/| [_] |[/| [_\][/ | | \][/| [_\]
| ___/ | _] | | | _]
[\| [/] [\| [_/] [\| |/] [\| [_/]
[_____] [______] [_____] [______]
xseal at harborside.com ICQ:13466657
http://www.harborside.com/home/x/xseal/euphoria/
|
Not Categorized, Please Help
|
|