Useful error reporting is a difficult problem.  It is dual with programming.

Programmers are humans that instruct machines (under a wide variety of 
cirumstances).  I have yet to meet a machine that can
instruct humans (under a similarly wide variety of circumstances).

If your program has an error, you most likely introduced it, and are the one 
person best suited to identifying and correcting it.
Regardless of fault, if you get an error, at some point you're going to have to 
use (human) reasoning to remedy the problem.  

Of course, this is a continuum.  We have an interpreter, so it could be smarter 
/ more specific about error reporting.  Then
again, the smarter it is, the more likely it is the smarts themselves contain 
bugs, and will produce misleading reports.  

Have you ever missed out a semicolon in a C program?  Did the compiler say 
"hey, you missed out a semicolon"?  Or did it vomit 16
paragraphs of noise, which you eventually learned (using human reason) meant 
"hey, I must've missed out a semicolon"?  

So the question is where to draw the line.  I for one would support the notion 
of deprecating "domain error" as an umbrella.  I
want valence error back.  I want  3 : 'y=:10'0  to be an assignment error.  I 
could think of more.

But I wouldn't go much further than that.  For example, we could change the 
interpreter to signal errors like this:

           x + y
        |domain error: left hand argument to  +  is literal, not numeric
        |   x    +y
           
But how much would that help you?  You could have worked out that much 
yourself, in less than a minute.  What you'd really like
is:  

           x + y
        |domain error: John Smith declared NorthWind.Sales.Qty 
        |as varchar, not int.  Call him at 212 555 1212
        |   x    +y
           
Don't hold your breath.

-Dan

PS:  I've also been frustrated by J's terse error messages.  Usually when it 
occurs in a long, complicated piece of code.  I find
I can mitigate the problem by breaking my code into smaller pieces then 
recombining them (which has other nice effects).

PPS:  You might find this entertaining:
     http://www.jsoftware.com/pipermail/general/2005-December/025974.html

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to