From c791af1593439b3050d34f625b2175c8a6d7c129b3ab252433be95d5bf56c1f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Linus=20Bj=C3=B6rnstam?= Date: Thu, 22 Oct 2026 15:06:15 +0200 Subject: [PATCH] Unused definitions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- _01.Language-basics.sz | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/_01.Language-basics.sz b/_01.Language-basics.sz index f5d2fb7..532f789 100644 --- a/_01.Language-basics.sz +++ b/_01.Language-basics.sz @@ -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. +@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} Bjolang follows scheme's naming conventiens. Predicates end with @code{?}. Mutating functions end with @code{!}. Conversions are written using @code{->}.