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

To reply to this bug, email your comments to 48315 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-guile <at> gnu.org:
bug#48315; Package guile. (Sun, 09 May 2021 15:58:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Maxime Devos <maximedevos <at> telenet.be>:
New bug report received and forwarded. Copy sent to bug-guile <at> gnu.org. (Sun, 09 May 2021 15:58:02 GMT) Full text and rfc822 format available.

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

From: Maxime Devos <maximedevos <at> telenet.be>
To: bug-guile <at> gnu.org
Subject: (ice-9 match) does not suport #nil
Date: Sun, 09 May 2021 17:57:41 +0200
[Message part 1 (text/plain, inline)]
guile --version:
guile (GNU Guile) 3.0.5

(use-modules (ice-9 match))

(match #nil (_ 'xyzzy))
-->
While compiling expression:
Syntax error:
unknown location: unexpected syntax in form ()

(match '() (_ 'xyzzy))
--> $16 = xyzzy

Greetings,
Maxime.
[signature.asc (application/pgp-signature, inline)]

Information forwarded to bug-guile <at> gnu.org:
bug#48315; Package guile. (Wed, 12 May 2021 20:05:01 GMT) Full text and rfc822 format available.

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)]

Added tag(s) patch. Request was from Taylan Kammer <taylan.kammer <at> gmail.com> to control <at> debbugs.gnu.org. (Sat, 15 May 2021 17:48:01 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 339 days ago.

Previous Next


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