Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: UNTRAPPABLE ERROR!

From: chris:starforge:demon at: 26-Jun-2001 15:07

[Robbo1Mark--aol--com] wrote:
> Has anybody else seen this problem or anything similar before?
I think what you're doing is making a fatal assumption about the nature of errors in REBOL. REBOL can't do the same thing as, say, a C compiler otherwise it could report the /lines/binary error before the script even started. gcc can pick up things like "too many arguments" problems during the compilation process but REBOL interprets on the fly - it can't do that. Normal errors are "runtime exceptions" - incorrect values appearing somewhere and so on. These are non-fatal problems that can be overcome programatically via a try/disarm construct. They are "correct" programs which generate an exceptional result. The error you have hit upon is something more drastic - a low level interpreter exception. This simply can not be caught and handled because you're trying to tell the interpreter to do something that, while syntactically correct, is logically and physically incorrect. Do you know Java? Java has a very strange, but ultimately sensible, exception system: All subclasses of Exception must either be caught using a try{}catch(){} construct where they are thrown or the method in which the exception occurs must declare that it "throws" the exception and the handling is passed up to the next level in the program. There is an exception to this rule however: RuntimeExceptions do not have to be caught and the "throws" is not needed for them - they cover things like ArrayIndexOutOfBoundsException, NullPointerException and other "This was caused by a Bug" exceptions. These should generally not be caught as they indicate a serious - possibly unrecoverable - problem in your program. The situation in REBOL is similar - normal errors - Exceptions - can be caught and handled with impunity because they will often be intended or expected. They may indicate a problem has occured in the program, but it's a problem you expect and know how to fix. Interpreter RuntimeException errors - like the /lines/binary one - are an indication of a serious bug in your code that should stop the script working until it is fixed. Chris -- New sig in the works Explorer2260 Designer and Coder http://www.starforge.co.uk