GNU bug report logs - #48315
(ice-9 match) does not suport #nil

Previous Next

Package: guile;

Reported by: Maxime Devos <maximedevos <at> telenet.be>

Date: Sun, 9 May 2021 15:58:01 UTC

Severity: normal

Tags: patch

Full log


Message #8 received at 48315 <at> debbugs.gnu.org (full text, mbox):

From: Taylan Kammer <taylan.kammer <at> gmail.com>
To: 48315 <at> debbugs.gnu.org
Subject: (ice-9 match) does not suport #nil
Date: Wed, 12 May 2021 22:03:57 +0200
[Message part 1 (text/plain, inline)]
This was mind-boggling to debug!

In syntax-rules, the pattern (x ...) will match #nil, since it
matches the empty list.  This can have surprising consequences.

Consider:

  (define-syntax test
    (syntax-rules ()
      ((test (x ...))
       (x ...))
      ((test x)
       x)))

  (test (+ 1 2))  ; => 3
  (test 123)      ; => 123
  (test #f)       ; => #f
  ;; However...
  (test #nil)     ; error


Anyway, attached is a patch to fix the issue in match.


- Taylan
[0001-Fix-match-when-used-directly-on-the-nil-constant.patch (text/plain, attachment)]

This bug report was last modified 4 years and 31 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.