Re: Robert Craig... One Wish Please
- Posted by Sabal.Mike at notations.com Jul 31, 2002
- 386 views
Responses are below Rob's comments: >>> rds at RapidEuphoria.com 07/30/02 11:49PM >>> - People might start to "abuse" the feature, This is true, but namespaces have potential for abuse too. Unlike goto, which is a stylistic enhancement, a crash_routine has highly functional value. - There are issues, such as: Do we allow the exception handler to return? Do we provide the exception handler with a standardized error code so it will know what happened? etc. The issue is really whether we trap the error before it occurs with hundreds of lines of error-checking code, or do we trap it after it occurs with hundreds of lines of error-handling code? The cleaner method is to trap the error before it occurs. However, most programmers will miss potential problems when designing. There needs to be a method of logging these bugs and allowing the user to continue working if at all possible. For example, a common bug is reading past the end of a sequence or writing past the end of a sequence. The crash_routine is called with the standard code for an invalid sequence index as well as the routine name (or line number) in which the error occurred. The routine opens for append a buglog, records the error, and closes the file. If the programmer is aware of this intermittent error, and can simply increase the size of the sequence and return, the user can happily continue his/her work until the true bug can be found. If the programmer cannot tell what sequence needs to be lengthened, he/she can, still in the crash_routine, analyze the current record being entered (or whatever other work is currently in progress) for data integrity and save the record before the file gets closed. Also a message_box can be displayed, as opposed to the console-based crash_message. This is the real benefit to having a crash_routine, and these are things that cannot be managed by existing Euphoria routines. Michael J. Sabal