bug-guile
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#48315: (ice-9 match) does not suport #nil


From: Taylan Kammer
Subject: bug#48315: (ice-9 match) does not suport #nil
Date: Wed, 12 May 2021 22:03:57 +0200
User-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.10.1

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

Attachment: 0001-Fix-match-when-used-directly-on-the-nil-constant.patch
Description: Text document


reply via email to

[Prev in Thread] Current Thread [Next in Thread]