Subject: (ice-9 match): warning: unused variable `failure'

From: Tomas Volf <[email-masked]>
Date: Sat, 01 Feb 2025 21:08:32 +0100

Hi,

--8<---------------cut here---------------start------------->8---
(use-modules (ice-9 match))

(match-lambda (_ #f))
--8<---------------cut here---------------end--------------->8---

This source code leads to a warning when compiled:

--8<---------------cut here---------------start------------->8---
$ guix shell guile-next -- guild compile -W3 -o /tmp/xx.go /tmp/xx.scm
/tmp/xx.scm:3:0: warning: unused variable `failure'
wrote `/tmp/xx.go'
--8<---------------cut here---------------end--------------->8---

Looking at the expansion

--8<---------------cut here---------------start------------->8---
(lambda (expr)
  (let* ((v expr)
         (failure
           (lambda ()
             ((@@ (ice-9 match) throw)
              'match-error
              "match"
              "no matching pattern"
              v)
             #f)))
    #f))
--8<---------------cut here---------------end--------------->8---

the `failure' is indeed unused.  I took a look at the source code but it
is bit beyond my current abilities, so I am not sure how to fix it.

Tomas

-- 
There are only two hard things in Computer Science:
cache invalidation, naming things and off-by-one errors.