#NAME?: an unknown name
#NAME? means that the program uses a name that Vex does not know: an op or a variable. A spreadsheet gives the same code for a function name with a spelling error.
app("explode", ref("position"))| origin | A | B | C | D |
|---|---|---|---|---|
| result | #NAME? unknown-op | #NAME? unknown-op | #NAME? unknown-op | #NAME? unknown-op |
The program applies the op explode to a position. Vec2Domain accepts the position, but it does not declare explode. The message is the domain "Vec2" has no op "explode".
| Kind | Cause |
|---|---|
unknown-op |
The domain of the receiver does not declare the op. An inherited member, for example toString, is not an op. Also an op without arguments that is not a free function, and an ext kind without a handler. |
unbound |
A var reads a name that no let binds. |
How the types prevent it
Section titled “How the types prevent it”._ lists only the ops of the domain of the current value. Thus ._.explode() does not compile. After an op gives a value that no domain of the chain accepts, the chain has no ._.
root.from("position")._.explode(); // type error: Vec2 has no op "explode"root.from("position")._.length()._.halve(); // type error: halve is not an op of NumThe builder makes the names of with, fork and the axes itself. Thus a program from the builder has no unbound name. The program above is possible only as IR, for example from JSON.
The fix
Section titled “The fix”- Use an op of the domain. The domains page lists the ops of each domain.
- To add an op, declare it in the
opsof the domain. Or setmethods: "all", and each method of a value is an op. - For a free function, give it in
fns:vex(...domains).withOptions({ fns: { myOp } }).
Refer to error values for the other codes.