REBOL 3.0

A script error? Really?

Carl Sassenrath, CTO
REBOL Technologies
6-Feb-2008 18:16 GMT

Article #0115
Main page || Index || Prior Article [0114] || Next Article [0116] || 10 Comments || Send feedback

You know how I like to say that the simplest things can be the most difficult? Here's another one to consider.

In R3 (and R2) errors tell you their general category. For example, at the console you type:

>> vista
** Script error: vista has no value

So, is that message really true? (The "Script error" part, that is. I think we know about the second part - the cow is being milked to the fullest.)

But, is it really a script error? Where's the script?

In fact, this is an evaluation or runtime error, not really a script error. Those of us who know REBOL understand what the message means. We translate it in our heads.

Originally, I picked the term "script error" because it sounded more friendly. It was just pointing out that you created an error with your script.

These days I regret that naming decision. Yes, it is a small thing, but I would prefer an error message more like:

>> vista
** Runtime error: vista has no value

The message could easily be changed. But, "easily" is like that word "simple". There's a deeper issue.

The problem can be seen in this example:

>> probe try [vista]
make error! [
    code: 300
    type: 'Script
    id: 'no-value
    arg1: 'vista
    arg2: none
    arg3: none
    near: [try [vista]]
    where: [try]
]

The type for the error is identified by the word 'script. If your program is handling its own errors, it may very well use that type field to figure out how to proceed. Changing it to 'runtime would require changes to such scripts.

It also works the other way around. You can make your own error objects by specifying the type, id, and arguments of the error. For example:

>> make error! [type: 'script id: 'no-value arg1: 'example]
** script error: example has no value

Here again the word 'script is important. It states the type of the error, which indicates where the message itself can be found (within the error message catalog.)

I guess we'll need to stick with "script errors" forever, right? Well, we can debate it if you like. Now, with R3, this is the time. Sure, in the bigger picture, it's a small thing. But, it does make a nice, quick blog topic.

I'm open to your thoughts.

10 Comments

REBOL 3.0
Updated 19-Apr-2024 - Edit - Copyright REBOL Technologies - REBOL.net