Devon wrote:
> I like the way J handles errors by providing a few broad
> categories that cover many cases.
I generally agree with Devon's comments, here. I like the way J signals error
[1]. But I can sympathize with the other camp: certainly, when I was a newbie,
I was frustrated by J's terse error messages (and, IIRC, made similar requests
for more verbose, specific error messages).
If anyone's interested I can pull up some old threads that discuss what we can
do to help the newbies in this regard (e.g. a JAL addon similar to 'trace'
which would inspect a buggy sentence and spit out as many relevant details as
possible).
> "Domain error" is not a catch-all - it refers to a specific condition.
Here I agree and disagree. "True" domain errors are just as you've described
them, but over the years the error has accreted other meanings. For example:
'right argument' 3 : 'y' 'left argument'
|domain error
| 'right argument' 3 :'y''left argument'
and:
3 : 'y =: ''global assignment''' 'argument'
|domain error
| y =:'global assignment'
and:
3 : '' 'argument'
|domain error
| 3 :'''argument'
Now, one could argue that "too many arguments" is a domain error in the sense
that it means "there's something wrong with your arguments", but that's a
stretch (especially given that this condition used to have its own name:
valence error). Similarly one could argue that previously-defined local names
are "not in the domain" of the global copula, =: .
But if you started down this path, you could eliminate most errors by putting
them under the umbrella of "wrong type of argument" (e.g. "limit error" becomes
"domain error" because "that argument is too big"). J is a functional language
after all -- most results are completely determined by the explicit arguments.
[2]
> with the possible exception of Dan Bron who
> probably gets more "nonce errors" than everyone
> else combined.
I'm actually prouder when I encounter a "system error", because the DoJ says
they're "impossible" :) [3,4] .
-Dan
[1] http://www.jsoftware.com/pipermail/general/2005-December/025974.html
[2] http://www.jsoftware.com/pipermail/chat/2007-December/000757.html
[3] http://www.jsoftware.com/help/dictionary/errors.htm
[4] In fact, I think you (Devon) were the one who actually discovered
the last system error I reported:
http://www.jsoftware.com/jwiki/System/Interpreter/Bugs07#head-521fb04fad8972876dc0ea7395d775c39c67cda6
and with a little sleight-of-hand you can still coax it out of the latest
version:
;,~{:3 :'5!:1&.<''y'''$.1 2 3
scheck a rank
|system error
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm