GNU bug report logs - #48318
(ice-9 match) does not allow distinguishing between () and #nil

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: guile; Reported by: Maxime Devos <maximedevos@HIDDEN>; dated Sun, 9 May 2021 16:44:02 UTC; Maintainer for guile is bug-guile@HIDDEN.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 9 May 2021 16:43:03 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun May 09 12:43:03 2021
Received: from localhost ([127.0.0.1]:56202 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1lfmWF-0001Rd-Eg
	for submit <at> debbugs.gnu.org; Sun, 09 May 2021 12:43:03 -0400
Received: from lists.gnu.org ([209.51.188.17]:46270)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <maximedevos@HIDDEN>) id 1lfmWD-0001RD-U7
 for submit <at> debbugs.gnu.org; Sun, 09 May 2021 12:43:02 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:57154)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <maximedevos@HIDDEN>)
 id 1lfmWD-0008Gz-EU
 for bug-guile@HIDDEN; Sun, 09 May 2021 12:43:01 -0400
Received: from baptiste.telenet-ops.be ([2a02:1800:120:4::f00:13]:57922)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <maximedevos@HIDDEN>)
 id 1lfmW7-0008Pt-J7
 for bug-guile@HIDDEN; Sun, 09 May 2021 12:43:01 -0400
Received: from butterfly.local ([213.251.116.230])
 by baptiste.telenet-ops.be with bizsmtp
 id 2giq2500C4yL7Jl01girJw; Sun, 09 May 2021 18:42:51 +0200
Message-ID: <4c8839f49a6c7317324d5360d74594c181b0588b.camel@HIDDEN>
Subject: (ice-9 match) does not allow distinguishing between () and #nil
From: Maxime Devos <maximedevos@HIDDEN>
To: bug-guile@HIDDEN
Date: Sun, 09 May 2021 18:42:40 +0200
Content-Type: multipart/signed; micalg="pgp-sha512";
 protocol="application/pgp-signature"; boundary="=-W7rR4/1OKaSnlkD/yGzq"
User-Agent: Evolution 3.34.2 
MIME-Version: 1.0
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telenet.be; s=r21;
 t=1620578571; bh=7wkOmWiEKsCwhuuaqm/p8KeOavnK7CDbREpqWJa2+Fg=;
 h=Subject:From:To:Date;
 b=aKnPqmtsi6b3142x8U/0faw2a7DVnuutM9wYiE/QrD/guKP4/6PV1WjqoSXBYaqkX
 ExusR48lTJGFJ+9k8V40/hLXHgJ4WwTELagAEMDXlokgWBYoB6KWGdtCL4Ju3hLp8Z
 Phnq2nsGPfmcV2B3JRknVQJN6ZuV5CLJjLSqEsPmma9S6DB5nGrjAHhwIFWpNen8bk
 vbPk5HZ7zCubIMcjM4wgWKhSe95xj7K6S8ihvAoa3YKDGkVaBLCt4yhsHI2AGbO7gA
 3fJFPTM8zc3N0K7gudHUIbjiBceH0GWL/Unuvsq5JnR2J4QWL6NcYuSKpM9sGQZSAm
 AnRcwqj9kh6Jw==
Received-SPF: pass client-ip=2a02:1800:120:4::f00:13;
 envelope-from=maximedevos@HIDDEN; helo=baptiste.telenet-ops.be
X-Spam_score_int: -27
X-Spam_score: -2.8
X-Spam_bar: --
X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001,
 RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -0.5 (/)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.3 (--)


--=-W7rR4/1OKaSnlkD/yGzq
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

Hi guilers,

I've found the following surprising behaviour:

(use-modules (ice-9 match))
(match (identity #nil) (() 'scheme-eol) (#nil 'elisp-eol))
--> scheme-eol, expected elisp-eol

(match '() (#nil 'elisp-eol) (() 'elisp-eol))
--> elisp-eol, expected scheme-eol

Treating () and #nil as equivalent makes sense, but should be
documented.

My suspicion, currently untested: the following code in
ice-9/match.upstream.scm ...

(define-syntax match-two
  (syntax-rules (_ ___ ..1 *** quote quasiquote ? $ =3D and or not set! get=
!)
    ((match-two v () g+s (sk ...) fk i)
     (if (null? v) (sk ... i) fk))
    [..]

should be:

(define-syntax match-two
  (syntax-rules (_ ___ ..1 *** quote quasiquote ? $ =3D and or not set! get=
!)
    ((match-two v () g+s (sk ...) fk i)
     (if (eq? v '()) (sk ... i) fk))
    ((match-two v #nil g+s
(sk ...) fk i)
     (if (eq? v #nil) (sk ... i) fk))
    [...]

And the following might need similar adjustment:

    ((match-two v (p) g+s sk fk i)
     (if (and (pair? v) (null? (cdr v)))
         (let ((w (car v)))
           (match-one w p ((car v) (set-car! v)) sk fk i))
         fk))

Greetings,
Maxime.

--=-W7rR4/1OKaSnlkD/yGzq
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: This is a digitally signed message part
Content-Transfer-Encoding: 7bit

-----BEGIN PGP SIGNATURE-----

iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYJgRABccbWF4aW1lZGV2
b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7sMsAP46Jl7Xfo8PL/lkADk9yc7MvtVr
whcPMIpVkvgLIauCKQEA113noQSu2c4N38v3QjG3BmN8+KX1qsAZwBEpOyyN2gE=
=8eS9
-----END PGP SIGNATURE-----

--=-W7rR4/1OKaSnlkD/yGzq--





Acknowledgement sent to Maxime Devos <maximedevos@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-guile@HIDDEN. Full text available.
Report forwarded to bug-guile@HIDDEN:
bug#48318; Package guile. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Sun, 9 May 2021 16:45:01 UTC

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