Unused definitions

A subsection after typed holes: the compiler warns about a definition
nothing uses, and a leading _ keeps one on purpose.

🤖 Generated with [ECA](https://eca.dev)

Co-Authored-By: eca-agent <git@eca.dev>
This commit is contained in:
Linus Björnstam 2026-10-22 15:06:15 +02:00
parent 2a4e3b3fcf
commit c791af1593

View file

@ -185,6 +185,12 @@ The bindings closest to the hole are listed first: locals, then your own module'
While a hole's type is still open, the other errors in the same definition are held back, since they are often caused by the hole. Once you fill it in, they show up. While a hole's type is still open, the other errors in the same definition are held back, since they are often caused by the hole. Once you fill it in, they show up.
@subsubsection{Unused definitions}
The compiler warns about definitions nothing uses: a top-level @code{def} or @code{defun} that the module doesn't export and nothing in it reads, and a local binding (a @code{let}, a @code{def} in a body, a loop variable) that nothing in its scope reads. Dead code piles up quietly in a large program, and this keeps it from doing so.
If you keep something on purpose, start its name with an underscore: @code{(def _registered (register!))}, or @code{(:for _ (range 0 n))} for a loop that just repeats. Parameters and pattern variables are not checked.
@subsubsection{Naming conventions} @subsubsection{Naming conventions}
Bjolang follows scheme's naming conventiens. Predicates end with @code{?}. Mutating functions end with @code{!}. Conversions are written using @code{->}. Bjolang follows scheme's naming conventiens. Predicates end with @code{?}. Mutating functions end with @code{!}. Conversions are written using @code{->}.