<< >> Contents Help

# 42. Error Messages

When J encounters an error executing a sentence it stops and displays the sentence. The interpreter removes any excess spaces from the sentence and then add three spaces before the word whose execution triggered the error. For example:

2 3 + 0 1 2 * 3 4 5

|length error

| 2 3 +0 1 2*3 4 5

The error occurred during the execution of the + verb.

The errors you are most likely to encounter are:

control error You have an incomplete control structure, for example an if. without matching do./else./elseif. and end. .

domain error An operand has a value that is not allowed, for example a string operand to an arithmetic operation, or an out-of-range numeric left operand to dyad o. . Errors encountered during execution of wd are reported as domain errors.

file name error You specified a file name that is invalid, or attempted to read a nonexistent file.

file number error You specified a number that is not the number of an open file.

ill-formed name You used an illegal name, such as name_1ff_ (illegal because 1ff is not a valid locale name)

ill-formed number You used an illegal number such as 14h . A word that starts with a numeric character must be a valid number, and vice versa.

index error You attempted to access an element outside the bounds of an array.

length error You used a dyadic verb with operands that did not agree (i. e. one frame was not a prefix of the other). Or, a verb expected an operand of a certain length and you gave an incorrect length (for example 1 2 3 {. 5 5)

limit error You exceeded one of J's limits, for example by specifying a comparison tolerance greater than 2^_34 . The most common cause of a limit error is an infinite recursion that exhausts the available stack space.

nonce error You tried to do something reasonable, but the system doesn't support it yet. So, for the nonce, find another way to do it.

open quote Your sentence contains an unmatched single-quote.

out of memory The interpreter asked the operating system for enough memory to fulfill your request, but the operating system refused. You need to use smaller nouns.

rank error You specified an operand with an invalid rank.

spelling error You typed an erroneous . or : to produce a meaningless word like +.. or fred. .

syntax error Your sentence contains an invalid sequence of parts of speech, as in 5 + .

valence error You have tried to execute a verb, but no definition exists for the valence (monadic or dyadic) that you are trying to execute.

value error You have asked the interpreter to evaluate a name that has not been defined. There is more to this definition than meets the eye. A noun, adverb, or conjunction is evaluated when it is encountered during the right-to-left execution of a sentence. A verb is evaluated when (a) it is executed with its noun operand(s) or (b) when the name of the verb is typed as the only word in a sentence, at which time the verb is evaluated for display purposes. For example, the sentence

undefname

will result in a value error, because you are asking the interpreter to display the value of the undefined name. However, the sentence

name =: undefname

will not fail, because name is defined to be a reference to undefname, and undefname does not have to be evaluated (the undefined name is assumed to refer to a verb of infinite rank that will be defined later). Subsequently,

name

undefname

name is defined, but if we force the interpreter to use it:

name 5

|value error: undefname

| name 5

the underlying undefined name is exposed.

An important case is:

undefname1 undefname2

undefname1 undefname2

Note that this did not result in a value error. Recall that undefined names are assumed to be verbs; we defined a hook from the two presumed verbs and then asked the interpreter to display the hook. The interpreter was able to do that without evaluating either name. Either name by itself would produce a value error.

<< >> Contents Help