Skip to content
beloch

Errors

Every error is a compile error: a program that breaks a rule is rejected as a whole, and no output is written for it. A rejected program is reported as a span, a message and an optional hint (ADR 0028). The message states what is wrong in the terms of the program as written, and the hint states one thing the author can write instead; an error without a useful suggestion has no hint. This page states how an error is reported and lists the errors by the construct that raises them, with the message as the kernel prints it and the page that states the rule.

A file is parsed whole before any statement runs, and its annotations are checked with it (Annotations), so a syntax error is reported before the error of any statement, wherever in the file it stands. Then the statements run in program order, and the first statement that fails ends the run: an error in a later statement stays unreported until the earlier one is fixed. The span covers the statement, or the operand the kernel can blame on its own, such as an undefined name or a meet.

The command line prints the message with the source line and a caret under the span, prints the hint as a help: line beneath it, and exits with 1 (beloch fold).

A program on a page of the language that ends in ; expect error "…" fails with a message that contains the quoted text, and the build checks that it does; the programs below are such programs. In a message, a name in angle brackets stands for what the program wrote in that place.

messagehint
syntax error
unexpected character "<c>"
a text runs to its closing quote on the same line; \" and \\ are its only escapes

The parser reports the place where it stopped, and the grammar it holds the program to stands on Grammar. A text is the quoted argument of an annotation (Annotations). This program lacks the closing parenthesis of its construction and stops at the end of its second line with syntax error; it carries no tag on this page, because every tagged program is also held to the grammar:

paper square
mark (through .a .c
messagehint
undefined point .<name>in scope: <names>
undefined crease --<name>in scope: <names>
undefined instance $<name>

A reference to a name no statement bound (Names). The hint lists the names of that kind in scope, sorted, at most 12 before an ellipsis; an instance gets no hint. The errors of a second binding, of a definition, an application and an export stand on Names and definitions.

mark (through .a .x)
error: undefined point .x
 --> BELOCH-ERRORS.md:1:18
  |
1 | mark (through .a .x)
  |                  ^^ undefined point .x
  = help: in scope: .a .b .c .d
messagehint
<p> and <q> are at the same place, so there is no line through them
<p> and <q> are already at the same place

Axiom 1, through <p> <q>, and axiom 2, map <p> onto <q>, take two points that lie apart. The points are compared where they lie in the current state, so the error meets the same name written twice, and two material points a fold has brought together (axiom 1, axiom 2):

fold (map .b onto .a) (moving .b)
mark (through .a .b)
error: .a and .b are at the same place, so there is no line through them
 --> BELOCH-ERRORS.md:2:1
  |
1 | fold (map .b onto .a) (moving .b)
2 | mark (through .a .b)
  | ^^^^^^^^^^^^^^^^^^^^ .a and .b are at the same place, so there is no line through them
messagehint
<l> and <m> are parallel; they have no common point
<l> and <m> have no common point; the lines they lie on cross beyond their marks or off the paper
the meet of <l> and <m> is ambiguous: they cross at <n> points, <the points>narrow an operand with & so that one crossing remains
<l> and <m> overlap from <p> to <q>; a meet needs a single common point
<l> and <m> lie on one line; a meet needs a single common point

The meet, --l * --m and .[--l --m …], is the one paper point its operands have in common (Points). It fails with no common point, with 2 or more, and when the operands share a stretch of paper or lie on one boundary line; the ambiguous case lists the points in paper coordinates.

.x = --ab * --cd
error: --ab and --cd are parallel; they have no common point
 --> BELOCH-ERRORS.md:1:6
  |
1 | .x = --ab * --cd
  |      ^^^^^^^^^^^ --ab and --cd are parallel; they have no common point

The programs of this page that need the two diagonals start from this sheet:

A crease scored through several layers lies on several paper lines, so a line that crosses it may cross it twice:

fold (--bd) (moving .a)
.m = free on --bc from .b at 3/4
mark (perp --bc through .m) as --h    ; through both layers
.x = --h * --ac
error: the meet of --h and --ac is ambiguous: they cross at 2 points, (3/4, 3/4) and (1/4, 1/4)
 --> BELOCH-ERRORS.md:4:6
  |
1 | fold (--bd) (moving .a)
2 | .m = free on --bc from .b at 3/4
3 | mark (perp --bc through .m) as --h    ; through both layers
4 | .x = --h * --ac
  |      ^^^^^^^^^^ the meet of --h and --ac is ambiguous: they cross at 2 points, (3/4, 3/4) and (1/4, 1/4)
  = help: narrow an operand with & so that one crossing remains
messagehint
no segment of <bundle> matches
<bundle> is ambiguous: <n> segments matchadd a selector
--<name> is a bundle, not a single creaserestrict it with & or \
--<name> is no longer straight after foldingnarrow it to one piece with &, e.g. --<name> & .p
no crease or edge is incident to all of (<points>)
--[…] is ambiguous: <n> creases/edges match <points>add a constraint

Where a slot wants one line, as the axis of a write, a filter must leave one piece, a name bound to a bundle needs a filter, and a crease a fold has bent needs one too (Filters). The join --[…] is the one crease or edge through its points (Lines).

mark (map .a onto .b) as --m
fold (--bd) (moving .a)       ; bends --m
fold (--m) (moving .c)
error: --m is no longer straight after folding
 --> BELOCH-ERRORS.md:3:1
  |
1 | mark (map .a onto .b) as --m
2 | fold (--bd) (moving .a)       ; bends --m
3 | fold (--m) (moving .c)
  | ^^^^^^^^^^^^^^^^^^^^^^ --m is no longer straight after folding
  = help: narrow it to one piece with &, e.g. --m & .p
messagehint
<construction> is ambiguous: <n> folds carry it out, all landing on the paperadd (toward .x) or a heading
<construction>: no crease lands on the paper, so there is no fold to make
no fold of <construction> carries out all its alignments at once

A construction of axiom 5, 6 or 7 may have several candidate lines, and toward, moving and heading select among them (Selection). The selection fails when no candidate is left and when several are; the page states every message of the selection, with the stage that raises it.

mark (map --ac onto --bd)
error: map --ac onto --bd is ambiguous: 2 folds carry it out, all landing on the paper
 --> BELOCH-ERRORS.md:1:1
  |
1 | mark (map --ac onto --bd)
  | ^^^^^^^^^^^^^^^^^^^^^^^^^ map --ac onto --bd is ambiguous: 2 folds carry it out, all landing on the paper
  = help: add (toward .x) or a heading
messagehint
this fold needs `moving .p` to choose the side
moving <p> names no side of the fold line of <construction>
`up to` a crease needs `moving` to walk inward fromname the flap with a point instead

A fold along a line construction, fold (through …) or fold (perp …), and a fold along existing material, fold (--c), derive no side from their line: moving or toward names it, and a moving point on the axis names none. A fold whose up to names a crease walks inward from its moving flap, and the axiom 5 fold fold (map --l onto --m) derives no moving from its construction, so it needs one written (fold).

fold (through .a .c)
error: this fold needs `moving .p` to choose the side
 --> BELOCH-ERRORS.md:1:1
  |
1 | fold (through .a .c)
  | ^^^^^^^^^^^^^^^^^^^^ this fold needs `moving .p` to choose the side
fold (map .b onto .a) (moving .b) as --v
fold (map --ab onto --v) (up to --v)
error: `up to` a crease needs `moving` to walk inward from
 --> BELOCH-ERRORS.md:2:1
  |
1 | fold (map .b onto .a) (moving .b) as --v
2 | fold (map --ab onto --v) (up to --v)
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `up to` a crease needs `moving` to walk inward from
  = help: name the flap with a point instead
messagehint
<p> is not on the mark's line
the mark's extent needs two distinct points
the mark's extent from <p> to <q> crosses a folded crease (it leaves its flap)

The extent of a partial mark, between <p> <q> or at <p>, is cut from the mark's line, so each of its points lies on that line, and between takes two points apart. An extent is written onto one flap when on names it, and it stays on that flap: an extent that would cross a folded crease to reach its endpoint is an error. Without on, the mark writes a piece onto every flap under the extent, each clipped to its flap, and no extent crosses a crease (ADR 0036, mark).

mark (through .a .c) (between .a .b)
error: .b is not on the mark's line
 --> BELOCH-ERRORS.md:1:1
  |
1 | mark (through .a .c) (between .a .b)
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .b is not on the mark's line
.o = --ac * --bd
fold (map .a onto .o) (moving .a) as --f   ; the corner .a folds onto the center
.q = free on --ac from .a at 1/8            ; on the folded corner
mark (--ac) (between .q .c) (on .c)         ; .q lies on the corner, .c on the base
error: the mark's extent from .q to .c crosses a folded crease (it leaves its flap)
 --> BELOCH-ERRORS.md:4:1
  |
1 | .o = --ac * --bd
2 | fold (map .a onto .o) (moving .a) as --f   ; the corner .a folds onto the center
3 | .q = free on --ac from .a at 1/8            ; on the folded corner
4 | mark (--ac) (between .q .c) (on .c)         ; .q lies on the corner, .c on the base
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the mark's extent from .q to .c crosses a folded crease (it leaves its flap)

The errors above are the ones every program can meet, from its syntax to its first folds and marks. The errors of a construct's own items stand on its page, beside its syntax and its example:

  • sheets, shapes, units and free points: Language;
  • bindings, temps, definitions, applications and exports: Names and definitions;
  • the join, the filters and the flap operand: Operands;
  • the constructions of axioms 5 to 7 and their selection: Constructions;
  • the items of a write, and unfold, reverse, flatten and squash: Write statements; the checks of flatten, squash, reverse and unfold, with the message and hint each ships, stand in the kernel's tables (Fan, Reverse, Unfold);
  • annotations: Annotations.