Repository navigation
warning
warp tells you about code that runs but may not do what you meant. Every such message has a level:
| level | example |
|---|---|
| hint |
one plus two prefers 1 + 2; 2 ** 3 prefers 2 ^ 3
|
| weak |
@parallel square xs runs in sequence |
| normal | most warnings, and your own warn "careful"
|
| severe |
if key == ESCAPEE compares with a key name that names nothing |
The program still runs; the message names the line and, where it can, a fix:
warn "careful"; 1
warning: careful
Weak and severe warnings say their level: warning (weak): …, warning (severe): …. Errors are not warnings: they
stop the program (see Error).
Everything from hints up is shown by default. Raise the threshold on the command line:
warp --no-hints app.warp # from weak up (or WARP_HINTS=0)
warp --warnings=severe app.warp # only severe ones; hint, weak, normal, severeThe playground has the same choice as its "show … and up" select.
use strict in the program, or warp --strict, makes warnings from normal up errors:
use strict
"a" + warning("careful") // Error("careful")
--strict=<level> fails from that level instead: --strict=severe fails only on severe warnings, --strict=weak on
weak ones too. Hints never fail. See also strict and Footguns.