REBOL 3.0

Comments on: 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

Comments:

Gregg Irwin
6-Feb-2008 15:19:36
'Script is a good word here I think, unless you want to use 'program (which I don't). 'Runtime is a tricky concept, and could be applied, because what works in one place may not work in another. i.e. 'Script <> "compile-time".

out-of-memory is currently a script error, but seems more like an internal error to me, because it's not something I can control. That's what I see as the distinction. If I can avoid the error, but don't, it's a script error. If I choose to create an error myself, it's a user error. If it's not something I can control, it's an internal error. I think 'runtime is closer to 'internal than 'script.

Gabriele
7-Feb-2008 5:21:32
I'm ok with keeping Script...

Maybe alias 'script "runtime" ? ;)

Daniel
7-Feb-2008 6:47:23
If you regret that naming decision, and you are readying a release which is going to break things, then for God sake, what's your dilemma? Just do what you think is best, which we are all sure is exactly what you're doing for R3.

Jerry
7-Feb-2008 16:38:51
When you PROBE VISTA, you got no value from it. But when you PROBE REBOL, you got all the value(s). The second sentence here is a pun as well.
Henrik
8-Feb-2008 7:47:35
>> make money
** Script Error: money has no value
** Near: make money

I wish I could live like that. :-)

Anton
8-Feb-2008 8:57:58
I think it doesn't really matter what it's called. During debugging, we see it so often we figure out its exact meaning empirically. It could be "Blark error" and not cause any great problem. However, don't be afraid to change it because of compatibility breakage.
Steve, the eFishAnt
9-Feb-2008 12:41:41
While no one could argue that M$ Vista has no value...

Here is a suggestion for the wording, in REBOL dialect:

>>vista

Invalid word error: vista not defined.

;on the other hand, if Vista were actually defined, then REBOL should say: Defective product warning: Vista should be recalled. Contact M$ and complain... ;-)

maxim oliver-adlhoch
14-Feb-2008 15:04:28
IMHO.runtime is too vague a word,

script error, really sounds like a syntax error.

why not say:

>> vista
** evaluation error: vista currently has no value

the script is ok, its syntactically accurate, its actually able to start running it...

but its EVALUATION is not possible due to the context at that specific point in time not allowing you to *fullfill* that expression.

Pier Johnson
28-Feb-2008 15:17:42
Isn't truly:

>>vista 
Run halted: vista returns no value

or

>>vista 
RUN HALTED: UNDEFINED vista returns no value

After all, don't words act as pointers or labels to functions?

Pier Johnson
28-Feb-2008 15:24:25
or?

>>vista 
RUN HALTED: vista must return a value

or

>>vista 
RUN HALTED: vista must have a define value to return

or

>>vista 
RUN HALTED: UNDEFINED vista. Nothing to return.

or

>>vista 
RUN HALTED: Cannot return UNDEFINED vista.

Post a Comment:

You can post a comment here. Keep it on-topic.

Name:

Blog id:

R3-0115


Comment:


 Note: HTML tags allowed for: b i u li ol ul font span div a p br pre tt blockquote
 
 

This is a technical blog related to the above topic. We reserve the right to remove comments that are off-topic, irrelevant links, advertisements, spams, personal attacks, politics, religion, etc.

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