From unknown Sun Jun 22 00:11:41 2025 X-Loop: help-debbugs@gnu.org Subject: bug#13741: guile-2.0: optimize, and eq-ness of literals (test-suite) Resent-From: Daniel Hartwig Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-guile@gnu.org Resent-Date: Mon, 18 Feb 2013 03:29:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 13741 X-GNU-PR-Package: guile X-GNU-PR-Keywords: To: 13741@debbugs.gnu.org X-Debbugs-Original-To: bug-guile@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.13611581387081 (code B ref -1); Mon, 18 Feb 2013 03:29:01 +0000 Received: (at submit) by debbugs.gnu.org; 18 Feb 2013 03:28:58 +0000 Received: from localhost ([127.0.0.1]:33553 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U7HPV-0001q9-81 for submit@debbugs.gnu.org; Sun, 17 Feb 2013 22:28:58 -0500 Received: from eggs.gnu.org ([208.118.235.92]:59392) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U7HPT-0001q2-9B for submit@debbugs.gnu.org; Sun, 17 Feb 2013 22:28:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U7HOX-0007aa-4E for submit@debbugs.gnu.org; Sun, 17 Feb 2013 22:27:58 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-102.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, T_DKIM_INVALID, USER_IN_WHITELIST autolearn=unavailable version=3.3.2 Received: from lists.gnu.org ([208.118.235.17]:56327) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U7HOX-0007aW-0V for submit@debbugs.gnu.org; Sun, 17 Feb 2013 22:27:57 -0500 Received: from eggs.gnu.org ([208.118.235.92]:42521) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U7HOW-00019f-1z for bug-guile@gnu.org; Sun, 17 Feb 2013 22:27:56 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U7HOU-0007aD-Ma for bug-guile@gnu.org; Sun, 17 Feb 2013 22:27:55 -0500 Received: from mail-da0-f43.google.com ([209.85.210.43]:33036) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U7HOU-0007a9-Fq for bug-guile@gnu.org; Sun, 17 Feb 2013 22:27:54 -0500 Received: by mail-da0-f43.google.com with SMTP id u36so2268477dak.30 for ; Sun, 17 Feb 2013 19:27:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:subject:date:message-id:mime-version :content-type:content-transfer-encoding; bh=nZLGaLwx1dgMfyfs7oiEvRQ0abOSeMPYaH3rnBMR3NI=; b=NOAWTFWASjea5BV6B1mv/R1fnPVau8SeGJzWIB4LwLOuTYNsupleUVtQo3I+5AIVXo Ji4wVnhc5zE0T5/8HN2AR7F/USbGspxNvpM66QL9UmxnPjr76X17kRxJxIOqvXD0c67A oXQjYU/nQ8d02j604LTO2FlUkiSHo6cYh1LECTcKYpAAy70Hp4uVFE8xGO8AmY5bajYP pYq5chW+c2l1IqNdIIzewSfXScqgsky30ipFK4GGLHodE1uFZEW+2Ba5crFgzJD9OhC2 aZIbT5yDdQlX+p+8oAr2n6QMABisEltwfipdfuFzKgcdhSbT8VzUAZxrYBM8O/sUjimy WCxg== X-Received: by 10.66.81.166 with SMTP id b6mr32306162pay.7.1361158073747; Sun, 17 Feb 2013 19:27:53 -0800 (PST) Received: from io ([101.119.31.83]) by mx.google.com with ESMTPS id w2sm96750924pax.22.2013.02.17.19.27.51 (version=TLSv1.1 cipher=RC4-SHA bits=128/128); Sun, 17 Feb 2013 19:27:53 -0800 (PST) From: Daniel Hartwig Date: Mon, 18 Feb 2013 11:27:39 +0800 Message-ID: <87621q8fo4.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 208.118.235.17 X-Spam-Score: -3.4 (---) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -4.7 (----) Version: 2.0.7 # stable-2.0, around commit: 3d2b267 # ./configure (no arguments) hash.test has a failing case: FAIL: tests/hash.test: hash-set and hash-ref: ;; 1/2 and 2/4 are equal? and eqv? but not eq? (pass-if (equal? #f (let ((table (make-hash-table))) (hashq-set! table 1/2 (quote foo)) (hashq-ref table 1/2)))) which may be due to the optimizer or other component working on literals: scheme@(guile-user)> (eqv? 1/2 2/4) $1 =3D #t scheme@(guile-user)> (eq? 1/2 2/4) $2 =3D #f scheme@(guile-user)> ,optimize (eq? 1/2 2/4) $3 =3D #f scheme@(guile-user)> (hashq 1/2 31) $4 =3D 6 scheme@(guile-user)> (hashq 2/4 31) $5 =3D 20 scheme@(guile-user)> ,optimize (hashq 2/4 31) $6 =3D (hashq 1/2 31) scheme@(guile-user)> ;; uh oh The ramifications reach beyond hash functions: scheme@(guile-user)> (define x 1/2) scheme@(guile-user)> (eq? x 2/4) $7 =3D #f scheme@(guile-user)> ,optimize (eq? x 2/4) $8 =3D (eq? x 1/2) scheme@(guile-user)> (define y 2/4) scheme@(guile-user)> (eq? x y) $9 =3D #f scheme@(guile-user)> ,optimize (define y 2/4) $10 =3D (define y 1/2) I recall some discussion where it was made clear that literals can not be assumed eq?, and that *at least* eqv? should be used to compare numeric values unless they are known to be the same value (i.e. =E2=80=98(d= efine y x) (eq? x y)=E2=80=99). Is that right? This particular test and some others properly should fade away then, or at least drop the eq-case. From unknown Sun Jun 22 00:11:41 2025 X-Loop: help-debbugs@gnu.org Subject: bug#13741: guile-2.0: optimize, and eq-ness of literals (test-suite) Resent-From: ludo@gnu.org (Ludovic =?UTF-8?Q?Court=C3=A8s?=) Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-guile@gnu.org Resent-Date: Mon, 18 Feb 2013 09:18:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 13741 X-GNU-PR-Package: guile X-GNU-PR-Keywords: To: Daniel Hartwig Cc: 13741@debbugs.gnu.org Received: via spool by 13741-submit@debbugs.gnu.org id=B13741.136117908113861 (code B ref 13741); Mon, 18 Feb 2013 09:18:02 +0000 Received: (at 13741) by debbugs.gnu.org; 18 Feb 2013 09:18:01 +0000 Received: from localhost ([127.0.0.1]:33855 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U7MrJ-0003bW-1g for submit@debbugs.gnu.org; Mon, 18 Feb 2013 04:18:01 -0500 Received: from xanadu.aquilenet.fr ([88.191.123.111]:52242) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U7MrG-0003bN-FZ for 13741@debbugs.gnu.org; Mon, 18 Feb 2013 04:17:59 -0500 Received: from localhost (localhost [127.0.0.1]) by xanadu.aquilenet.fr (Postfix) with ESMTP id 0323EAFB9; Mon, 18 Feb 2013 10:16:59 +0100 (CET) Received: from xanadu.aquilenet.fr ([127.0.0.1]) by localhost (xanadu.aquilenet.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id BcHWyI8pqXM9; Mon, 18 Feb 2013 10:16:58 +0100 (CET) Received: from pluto (unknown [193.50.110.200]) by xanadu.aquilenet.fr (Postfix) with ESMTPSA id B653F68ED; Mon, 18 Feb 2013 10:16:58 +0100 (CET) From: ludo@gnu.org (Ludovic =?UTF-8?Q?Court=C3=A8s?=) References: <87621q8fo4.fsf@gmail.com> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 30 =?UTF-8?Q?Pluvi=C3=B4se?= an 221 de la =?UTF-8?Q?R=C3=A9volution?= X-PGP-Key-ID: 0xEA52ECF4 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 83C4 F8E5 10A3 3B4C 5BEA D15D 77DD 95E2 EA52 ECF4 X-OS: x86_64-unknown-linux-gnu Date: Mon, 18 Feb 2013 10:16:57 +0100 In-Reply-To: <87621q8fo4.fsf@gmail.com> (Daniel Hartwig's message of "Mon, 18 Feb 2013 11:27:39 +0800") Message-ID: <87k3q67zhy.fsf@gnu.org> User-Agent: Gnus/5.130005 (Ma Gnus v0.5) Emacs/24.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 1.5 (+) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has identified this incoming email as possible spam. The original message has been attached to this so you can view it (if it isn't spam) or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Daniel Hartwig skribis: > scheme@(guile-user)> (define x 1/2) > scheme@(guile-user)> (eq? x 2/4) > $7 = #f > scheme@(guile-user)> , optimize (eq? x 2/4) > $8 = (eq? x 1/2) > scheme@(guile-user)> (define y 2/4) > scheme@(guile-user)> (eq? x y) > $9 = #f > scheme@(guile-user)> , optimize (define y 2/4) > $10 = (define y 1/2) [...] Content analysis details: (1.5 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.7 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) 0.8 BAYES_50 BODY: Bayes spam probability is 40 to 60% [score: 0.5000] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: 1.5 (+) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has identified this incoming email as possible spam. The original message has been attached to this so you can view it (if it isn't spam) or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Daniel Hartwig skribis: > scheme@(guile-user)> (define x 1/2) > scheme@(guile-user)> (eq? x 2/4) > $7 = #f > scheme@(guile-user)> ,optimize (eq? x 2/4) > $8 = (eq? x 1/2) > scheme@(guile-user)> (define y 2/4) > scheme@(guile-user)> (eq? x y) > $9 = #f > scheme@(guile-user)> ,optimize (define y 2/4) > $10 = (define y 1/2) [...] Content analysis details: (1.5 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.7 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) 0.8 BAYES_50 BODY: Bayes spam probability is 40 to 60% [score: 0.5000] Daniel Hartwig skribis: > scheme@(guile-user)> (define x 1/2) > scheme@(guile-user)> (eq? x 2/4) > $7 =3D #f > scheme@(guile-user)> ,optimize (eq? x 2/4) > $8 =3D (eq? x 1/2) > scheme@(guile-user)> (define y 2/4) > scheme@(guile-user)> (eq? x y) > $9 =3D #f > scheme@(guile-user)> ,optimize (define y 2/4) > $10 =3D (define y 1/2) Quoth R5RS: `Eq?''s behavior on numbers and characters is implementation-dependent, but it will always return either true or false, and will return true only when `eqv?' would also return true. `Eq?' may also behave differently from `eqv?' on empty vectors and empty strings. What we may get wrong is that it looks as if it doesn=E2=80=99t always retu= rn either true or false, because the behavior depends on whether one of the operands is a literal. However, it=E2=80=99s fundamentally wrong to rely on eq? to compare numbers= . So the test case you mention seems buggy, to start with. WDYT? Ludo=E2=80=99. From unknown Sun Jun 22 00:11:41 2025 X-Loop: help-debbugs@gnu.org Subject: bug#13741: guile-2.0: optimize, and eq-ness of literals (test-suite) Resent-From: Daniel Hartwig Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-guile@gnu.org Resent-Date: Mon, 18 Feb 2013 10:04:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 13741 X-GNU-PR-Package: guile X-GNU-PR-Keywords: To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Cc: 13741@debbugs.gnu.org Received: via spool by 13741-submit@debbugs.gnu.org id=B13741.136118180017822 (code B ref 13741); Mon, 18 Feb 2013 10:04:01 +0000 Received: (at 13741) by debbugs.gnu.org; 18 Feb 2013 10:03:20 +0000 Received: from localhost ([127.0.0.1]:33880 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U7NZ8-0004dM-Sr for submit@debbugs.gnu.org; Mon, 18 Feb 2013 05:03:20 -0500 Received: from mail-ie0-f171.google.com ([209.85.223.171]:51315) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U7NZ5-0004dE-Gf for 13741@debbugs.gnu.org; Mon, 18 Feb 2013 05:03:16 -0500 Received: by mail-ie0-f171.google.com with SMTP id 10so6963194ied.2 for <13741@debbugs.gnu.org>; Mon, 18 Feb 2013 02:02:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:cc:content-type:content-transfer-encoding; bh=Fgs2bvKBUg5IDgb8xLgU7Rpo6gI/KM5g8W3UCQ/jqHs=; b=nKjOqaC8vL+1NoiDkrmA7UY4MLLYyqki2EcMBuNXTJq+9DJ+tRYS9cuCz6P9es6QxQ c+pLIZ/kFs5+7XYYU5IaHjMdlEMbz/NKb6flZQ7Kayy874TKwPBqpKruJ/IVpY95noQw RxEk9f3X46H63xLb9AXs7RtLTXseP6fjlskMQ+kNM97iz+8EFVm/wUhjEb1DbjfCZzeY Btfk4cncqjpA87z6kQMFRJydqid1md0TSkBp3w9JReoFH25qNogWUOjPVtkfK5RIMfga 1bsHX3vK2E5zFytcqyKm46+N1SH0xwi9Ybp9za/YoMKH/SynTtQglc1LUL+d0gM9W4PF Qj5g== MIME-Version: 1.0 X-Received: by 10.50.40.131 with SMTP id x3mr7195310igk.10.1361181735974; Mon, 18 Feb 2013 02:02:15 -0800 (PST) Received: by 10.64.76.51 with HTTP; Mon, 18 Feb 2013 02:02:15 -0800 (PST) In-Reply-To: <87k3q67zhy.fsf@gnu.org> References: <87621q8fo4.fsf@gmail.com> <87k3q67zhy.fsf@gnu.org> Date: Mon, 18 Feb 2013 18:02:15 +0800 Message-ID: From: Daniel Hartwig Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.1 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) On 18 February 2013 17:16, Ludovic Court=C3=A8s wrote: > Daniel Hartwig skribis: > >> scheme@(guile-user)> (define x 1/2) >> scheme@(guile-user)> (eq? x 2/4) >> $7 =3D #f >> scheme@(guile-user)> ,optimize (eq? x 2/4) >> $8 =3D (eq? x 1/2) >> scheme@(guile-user)> (define y 2/4) >> scheme@(guile-user)> (eq? x y) >> $9 =3D #f >> scheme@(guile-user)> ,optimize (define y 2/4) >> $10 =3D (define y 1/2) > > Quoth R5RS: > > `Eq?''s behavior on numbers and characters is > implementation-dependent, but it will always return either true or > false, and will return true only when `eqv?' would also return > true. `Eq?' may also behave differently from `eqv?' on empty > vectors and empty strings. > > What we may get wrong is that it looks as if it doesn=E2=80=99t always re= turn > either true or false, because the behavior depends on whether one of the > operands is a literal. I took that to mean only that eq? always returns a boolean, rather than requiring it to return the same boolean given the same numeric arguments. It would be fine to simplify some rationals and not others, as this action does not affect the outcome of eqv?. > However, it=E2=80=99s fundamentally wrong to rely on eq? to compare numbe= rs. So > the test case you mention seems buggy, to start with. > > WDYT? > > Ludo=E2=80=99. Right, the test cases involving eq-ness of numbers are broken, should be removed. Patch to follow. From unknown Sun Jun 22 00:11:41 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.428 (Entity 5.428) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Daniel Hartwig Subject: bug#13741: closed (Re: bug#13741: guile-2.0: optimize, and eq-ness of literals (test-suite)) Message-ID: References: <87bobha6as.fsf@pobox.com> <87621q8fo4.fsf@gmail.com> X-Gnu-PR-Message: they-closed 13741 X-Gnu-PR-Package: guile Reply-To: 13741@debbugs.gnu.org Date: Mon, 18 Feb 2013 17:21:03 +0000 Content-Type: multipart/mixed; boundary="----------=_1361208063-31077-1" This is a multi-part message in MIME format... ------------=_1361208063-31077-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #13741: guile-2.0: optimize, and eq-ness of literals (test-suite) which was filed against the guile package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 13741@debbugs.gnu.org. --=20 13741: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D13741 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1361208063-31077-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 13741-done) by debbugs.gnu.org; 18 Feb 2013 17:20:31 +0000 Received: from localhost ([127.0.0.1]:34966 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U7UOF-00084W-3q for submit@debbugs.gnu.org; Mon, 18 Feb 2013 12:20:31 -0500 Received: from a-pb-sasl-quonix.pobox.com ([208.72.237.25]:55345 helo=sasl.smtp.pobox.com) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U7UOC-00084O-Bx for 13741-done@debbugs.gnu.org; Mon, 18 Feb 2013 12:20:29 -0500 Received: from sasl.smtp.pobox.com (unknown [127.0.0.1]) by a-pb-sasl-quonix.pobox.com (Postfix) with ESMTP id 407E9C125; Mon, 18 Feb 2013 12:19:27 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type:content-transfer-encoding; s=sasl; bh=aNE0pqxvzQtR HOtbEsX8d6U+0Vw=; b=L3s/lO6Ez+6JhFYoEQb8JJd+2Qzp7wfrQojOzxsbXrcd q10ZsL7rYBTinvNM+8Tziin8YSVrO0EFvMseH/iHpaxVBu77sFxzPVPM4Myo0JAR L0yaaclKHxr8n6vu/scxXF630GqT2/cpb/0exMLnJDhla8dONbxR7inLciDTm+w= DomainKey-Signature: a=rsa-sha1; c=nofws; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type:content-transfer-encoding; q=dns; s=sasl; b=eAjj80 4j1D9UQaux0m69N/VDaPBnYKKcwUJXH8o+XxhIPgR0bBE7TX/uOGBhc9A7b/hjPo E/tR3GqkiFeIBAlTW6vxR+J+9mmMlsMj5aDJiRC51fRe/PV1NgzCwpUrwm3SZjbv GOnZ4PiwJjuHiBzxffccmyHu7ljmvnDX64GHo= Received: from a-pb-sasl-quonix.pobox.com (unknown [127.0.0.1]) by a-pb-sasl-quonix.pobox.com (Postfix) with ESMTP id 36DC4C124; Mon, 18 Feb 2013 12:19:27 -0500 (EST) Received: from badger (unknown [88.160.190.192]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by a-pb-sasl-quonix.pobox.com (Postfix) with ESMTPSA id 9544AC123; Mon, 18 Feb 2013 12:19:26 -0500 (EST) From: Andy Wingo To: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) Subject: Re: bug#13741: guile-2.0: optimize, and eq-ness of literals (test-suite) References: <87621q8fo4.fsf@gmail.com> <87k3q67zhy.fsf@gnu.org> Date: Mon, 18 Feb 2013 18:19:23 +0100 In-Reply-To: <87k3q67zhy.fsf@gnu.org> ("Ludovic =?utf-8?Q?Court=C3=A8s=22'?= =?utf-8?Q?s?= message of "Mon, 18 Feb 2013 10:16:57 +0100") Message-ID: <87bobha6as.fsf@pobox.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Pobox-Relay-ID: 58BBF1C0-79EF-11E2-BA60-9A5B0E5B5709-02397024!a-pb-sasl-quonix.pobox.com X-Spam-Score: 0.3 (/) X-Debbugs-Envelope-To: 13741-done Cc: 13741-done@debbugs.gnu.org, Daniel Hartwig X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.0 (-) On Mon 18 Feb 2013 10:16, ludo@gnu.org (Ludovic Court=C3=A8s) writes: > Daniel Hartwig skribis: > >> scheme@(guile-user)> (define x 1/2) >> scheme@(guile-user)> (eq? x 2/4) >> $7 =3D #f >> scheme@(guile-user)> ,optimize (eq? x 2/4) >> $8 =3D (eq? x 1/2) >> scheme@(guile-user)> (define y 2/4) >> scheme@(guile-user)> (eq? x y) >> $9 =3D #f >> scheme@(guile-user)> ,optimize (define y 2/4) >> $10 =3D (define y 1/2) > > Quoth R5RS: > > `Eq?''s behavior on numbers and characters is > implementation-dependent, but it will always return either true or > false, and will return true only when `eqv?' would also return > true. `Eq?' may also behave differently from `eqv?' on empty > vectors and empty strings. > > What we may get wrong is that it looks as if it doesn=E2=80=99t always re= turn > either true or false, because the behavior depends on whether one of the > operands is a literal. > > However, it=E2=80=99s fundamentally wrong to rely on eq? to compare numbe= rs. So > the test case you mention seems buggy, to start with. Agreed, FWIW. Fractions are allocated on the heap, and eq? picks out the difference between heap objects. Sometimes two values are the same object, and sometimes not. Closing the bug, but please follow up with any questions. Cheers, Andy --=20 http://wingolog.org/ ------------=_1361208063-31077-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 18 Feb 2013 03:28:58 +0000 Received: from localhost ([127.0.0.1]:33553 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U7HPV-0001q9-81 for submit@debbugs.gnu.org; Sun, 17 Feb 2013 22:28:58 -0500 Received: from eggs.gnu.org ([208.118.235.92]:59392) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U7HPT-0001q2-9B for submit@debbugs.gnu.org; Sun, 17 Feb 2013 22:28:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U7HOX-0007aa-4E for submit@debbugs.gnu.org; Sun, 17 Feb 2013 22:27:58 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-102.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, T_DKIM_INVALID, USER_IN_WHITELIST autolearn=unavailable version=3.3.2 Received: from lists.gnu.org ([208.118.235.17]:56327) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U7HOX-0007aW-0V for submit@debbugs.gnu.org; Sun, 17 Feb 2013 22:27:57 -0500 Received: from eggs.gnu.org ([208.118.235.92]:42521) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U7HOW-00019f-1z for bug-guile@gnu.org; Sun, 17 Feb 2013 22:27:56 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U7HOU-0007aD-Ma for bug-guile@gnu.org; Sun, 17 Feb 2013 22:27:55 -0500 Received: from mail-da0-f43.google.com ([209.85.210.43]:33036) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U7HOU-0007a9-Fq for bug-guile@gnu.org; Sun, 17 Feb 2013 22:27:54 -0500 Received: by mail-da0-f43.google.com with SMTP id u36so2268477dak.30 for ; Sun, 17 Feb 2013 19:27:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:subject:date:message-id:mime-version :content-type:content-transfer-encoding; bh=nZLGaLwx1dgMfyfs7oiEvRQ0abOSeMPYaH3rnBMR3NI=; b=NOAWTFWASjea5BV6B1mv/R1fnPVau8SeGJzWIB4LwLOuTYNsupleUVtQo3I+5AIVXo Ji4wVnhc5zE0T5/8HN2AR7F/USbGspxNvpM66QL9UmxnPjr76X17kRxJxIOqvXD0c67A oXQjYU/nQ8d02j604LTO2FlUkiSHo6cYh1LECTcKYpAAy70Hp4uVFE8xGO8AmY5bajYP pYq5chW+c2l1IqNdIIzewSfXScqgsky30ipFK4GGLHodE1uFZEW+2Ba5crFgzJD9OhC2 aZIbT5yDdQlX+p+8oAr2n6QMABisEltwfipdfuFzKgcdhSbT8VzUAZxrYBM8O/sUjimy WCxg== X-Received: by 10.66.81.166 with SMTP id b6mr32306162pay.7.1361158073747; Sun, 17 Feb 2013 19:27:53 -0800 (PST) Received: from io ([101.119.31.83]) by mx.google.com with ESMTPS id w2sm96750924pax.22.2013.02.17.19.27.51 (version=TLSv1.1 cipher=RC4-SHA bits=128/128); Sun, 17 Feb 2013 19:27:53 -0800 (PST) From: Daniel Hartwig To: bug-guile@gnu.org Subject: guile-2.0: optimize, and eq-ness of literals (test-suite) Date: Mon, 18 Feb 2013 11:27:39 +0800 Message-ID: <87621q8fo4.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 208.118.235.17 X-Spam-Score: -3.4 (---) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -4.7 (----) Version: 2.0.7 # stable-2.0, around commit: 3d2b267 # ./configure (no arguments) hash.test has a failing case: FAIL: tests/hash.test: hash-set and hash-ref: ;; 1/2 and 2/4 are equal? and eqv? but not eq? (pass-if (equal? #f (let ((table (make-hash-table))) (hashq-set! table 1/2 (quote foo)) (hashq-ref table 1/2)))) which may be due to the optimizer or other component working on literals: scheme@(guile-user)> (eqv? 1/2 2/4) $1 =3D #t scheme@(guile-user)> (eq? 1/2 2/4) $2 =3D #f scheme@(guile-user)> ,optimize (eq? 1/2 2/4) $3 =3D #f scheme@(guile-user)> (hashq 1/2 31) $4 =3D 6 scheme@(guile-user)> (hashq 2/4 31) $5 =3D 20 scheme@(guile-user)> ,optimize (hashq 2/4 31) $6 =3D (hashq 1/2 31) scheme@(guile-user)> ;; uh oh The ramifications reach beyond hash functions: scheme@(guile-user)> (define x 1/2) scheme@(guile-user)> (eq? x 2/4) $7 =3D #f scheme@(guile-user)> ,optimize (eq? x 2/4) $8 =3D (eq? x 1/2) scheme@(guile-user)> (define y 2/4) scheme@(guile-user)> (eq? x y) $9 =3D #f scheme@(guile-user)> ,optimize (define y 2/4) $10 =3D (define y 1/2) I recall some discussion where it was made clear that literals can not be assumed eq?, and that *at least* eqv? should be used to compare numeric values unless they are known to be the same value (i.e. =E2=80=98(d= efine y x) (eq? x y)=E2=80=99). Is that right? This particular test and some others properly should fade away then, or at least drop the eq-case. ------------=_1361208063-31077-1-- From unknown Sun Jun 22 00:11:41 2025 X-Loop: help-debbugs@gnu.org Subject: bug#13741: guile-2.0: optimize, and eq-ness of literals (test-suite) Resent-From: Mark H Weaver Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-guile@gnu.org Resent-Date: Mon, 18 Feb 2013 23:51:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 13741 X-GNU-PR-Package: guile X-GNU-PR-Keywords: To: ludo@gnu.org (Ludovic =?UTF-8?Q?Court=C3=A8s?=) Cc: 13741@debbugs.gnu.org, Daniel Hartwig Received: via spool by 13741-submit@debbugs.gnu.org id=B13741.136123142011753 (code B ref 13741); Mon, 18 Feb 2013 23:51:01 +0000 Received: (at 13741) by debbugs.gnu.org; 18 Feb 2013 23:50:20 +0000 Received: from localhost ([127.0.0.1]:35389 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U7aTQ-00033R-KE for submit@debbugs.gnu.org; Mon, 18 Feb 2013 18:50:20 -0500 Received: from world.peace.net ([96.39.62.75]:49707) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U7aTL-00033H-Oq for 13741@debbugs.gnu.org; Mon, 18 Feb 2013 18:50:15 -0500 Received: from 74-94-165-125-newengland.hfc.comcastbusiness.net ([74.94.165.125] helo=tines.lan) by world.peace.net with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.72) (envelope-from ) id 1U7aSF-0007mC-HJ; Mon, 18 Feb 2013 18:49:03 -0500 From: Mark H Weaver References: <87621q8fo4.fsf@gmail.com> <87k3q67zhy.fsf@gnu.org> Date: Mon, 18 Feb 2013 18:48:42 -0500 In-Reply-To: <87k3q67zhy.fsf@gnu.org> ("Ludovic \=\?utf-8\?Q\?Court\=C3\=A8s\=22'\?\= \=\?utf-8\?Q\?s\?\= message of "Mon, 18 Feb 2013 10:16:57 +0100") Message-ID: <87ip5pnpyd.fsf@tines.lan> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.8 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) ludo@gnu.org (Ludovic Court=C3=A8s) writes: > However, it=E2=80=99s fundamentally wrong to rely on eq? to compare numbe= rs. So > the test case you mention seems buggy, to start with. Agreed. I removed the buggy test. Thanks, Mark From unknown Sun Jun 22 00:11:41 2025 X-Loop: help-debbugs@gnu.org Subject: bug#13741: [PATCH] test-suite: eq-ness of numbers, characters is unspecified Resent-From: Daniel Hartwig Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-guile@gnu.org Resent-Date: Tue, 19 Feb 2013 01:57:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 13741 X-GNU-PR-Package: guile X-GNU-PR-Keywords: To: 13741@debbugs.gnu.org Received: via spool by 13741-submit@debbugs.gnu.org id=B13741.136123900326313 (code B ref 13741); Tue, 19 Feb 2013 01:57:02 +0000 Received: (at 13741) by debbugs.gnu.org; 19 Feb 2013 01:56:43 +0000 Received: from localhost ([127.0.0.1]:35504 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U7cRl-0006qL-BU for submit@debbugs.gnu.org; Mon, 18 Feb 2013 20:56:42 -0500 Received: from mail-pb0-f53.google.com ([209.85.160.53]:57485) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U7cRg-0006qB-9G for 13741@debbugs.gnu.org; Mon, 18 Feb 2013 20:56:39 -0500 Received: by mail-pb0-f53.google.com with SMTP id un1so1946907pbc.26 for <13741@debbugs.gnu.org>; Mon, 18 Feb 2013 17:55:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:subject:date:message-id:x-mailer:in-reply-to :references:mime-version:content-type:content-transfer-encoding; bh=l2O+FysUJm6YrWks+wh3BmsreuS7Rr0coPD8+iQzOfw=; b=c4hcm9nSB1PprLVFawBMttw3o4+xfEFhES+UQvKlmOueOICNthWmkWtneApaPFuJuX 2Xpo9zp5qcIM4tUCoV1ra8CMt2cl4dzb38XZo/YYGa0Dz66zQGZPcqm+E6AOIro1DL/s yTijhbMQCVG4vvJRlGQo0T5l+pORVcQPuGX3IYmncBFN0lCw9lUpPfh0lGZiv5fFoiFi g2a5ixgFI0q9cyHcMz97lHeVVj9xIGQws0Nu8hDZdyJucZ012fwuM70fm3cxvqmJOqbv D162gh/9Ry0O1zVQqOhwMNqKEiugJIYNPmNbSCCxqUS8pmZfRyBCi0HdSW/zvr0GT3ds rVDg== X-Received: by 10.68.49.97 with SMTP id t1mr35619456pbn.125.1361238932831; Mon, 18 Feb 2013 17:55:32 -0800 (PST) Received: from localhost.localdomain ([101.119.31.96]) by mx.google.com with ESMTPS id zm1sm16167161pbc.26.2013.02.18.17.55.27 (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 18 Feb 2013 17:55:32 -0800 (PST) From: Daniel Hartwig Date: Tue, 19 Feb 2013 09:55:14 +0800 Message-Id: <1361238914-14823-1-git-send-email-mandyke@gmail.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <87ip5pnpyd.fsf@tines.lan> References: <87ip5pnpyd.fsf@tines.lan> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Score: 0.1 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) * test-suite/tests/00-socket.test: * test-suite/tests/alist.test: * test-suite/tests/elisp.test: * test-suite/tests/encoding-iso88591.test: * test-suite/tests/encoding-iso88597.test: * test-suite/tests/encoding-utf8.test: * test-suite/tests/hash.test: * test-suite/tests/i18n.test: * test-suite/tests/modules.test: * test-suite/tests/ports.test: * test-suite/tests/srfi-35.test: Make tests use eqv? instead of eq? when comparing numbers, characters. Checked also for similar uses of assq[-ref]. * test-suite/tests/vlist.test ("vhash-delete honors HASH"): Change test to use eqv-ness, not eq-ness, which should not impact its purpose as these two are equivalent for strings. --- test-suite/tests/00-socket.test | 6 +++--- test-suite/tests/alist.test | 4 ++-- test-suite/tests/elisp.test | 8 ++++---- test-suite/tests/encoding-iso88591.test | 10 +++++----- test-suite/tests/encoding-iso88597.test | 10 +++++----- test-suite/tests/encoding-utf8.test | 10 +++++----- test-suite/tests/hash.test | 6 +----- test-suite/tests/i18n.test | 20 ++++++++++---------- test-suite/tests/modules.test | 2 +- test-suite/tests/ports.test | 8 ++++---- test-suite/tests/srfi-35.test | 16 ++++++++-------- test-suite/tests/vlist.test | 8 ++++---- 12 files changed, 52 insertions(+), 56 deletions(-) diff --git a/test-suite/tests/00-socket.test b/test-suite/tests/00-socket.test index 6deb285..8079cf5 100644 --- a/test-suite/tests/00-socket.test +++ b/test-suite/tests/00-socket.test @@ -336,7 +336,7 @@ (if (not server-pid) (throw 'unresolved) (let ((status (cdr (waitpid server-pid)))) - (eq? 0 (status:exit-val status))))) + (eqv? 0 (status:exit-val status))))) (false-if-exception (delete-file path)) @@ -409,7 +409,7 @@ (if (not server-pid) (throw 'unresolved) (let ((status (cdr (waitpid server-pid)))) - (eq? 0 (status:exit-val status))))) + (eqv? 0 (status:exit-val status))))) (false-if-exception (delete-file path)) @@ -505,7 +505,7 @@ (if (not server-pid) (throw 'unresolved) (let ((status (cdr (waitpid server-pid)))) - (eq? 0 (status:exit-val status))))) + (eqv? 0 (status:exit-val status))))) #t))) diff --git a/test-suite/tests/alist.test b/test-suite/tests/alist.test index 699c10e..0ed5d22 100644 --- a/test-suite/tests/alist.test +++ b/test-suite/tests/alist.test @@ -124,8 +124,8 @@ (pass-if "assoc-ref" (let ((x (assoc-ref b "one"))) (and (list? x) - (eq? (car x) 2) - (eq? (cadr x) 3)))) + (eqv? (car x) 2) + (eqv? (cadr x) 3)))) (pass-if-not "assoc-ref not" (assoc-ref a 'testing)) diff --git a/test-suite/tests/elisp.test b/test-suite/tests/elisp.test index 41800fd..baf8546 100644 --- a/test-suite/tests/elisp.test +++ b/test-suite/tests/elisp.test @@ -124,8 +124,8 @@ (with-fluids* (cons f (cons g #nil)) '(3 4) (lambda () - (and (eq? (fluid-ref f) 3) - (eq? (fluid-ref g) 4)))))) + (and (eqv? (fluid-ref f) 3) + (eqv? (fluid-ref g) 4)))))) (pass-if "append!" (let ((a (copy-tree '(1 2 3))) @@ -150,11 +150,11 @@ '(5 4 3 2 1))) ; Ditto. (pass-if "list-ref" - (eq? (list-ref '(0 1 2 3 4 . #nil) 4) 4)) + (eqv? (list-ref '(0 1 2 3 4 . #nil) 4) 4)) (pass-if-exception "list-ref" exception:out-of-range - (eq? (list-ref '(0 1 2 3 4 . #nil) 6) 6)) + (eqv? (list-ref '(0 1 2 3 4 . #nil) 6) 6)) (pass-if "list-set!" (let ((l (copy-tree '(0 1 2 3 4 . #nil)))) diff --git a/test-suite/tests/encoding-iso88591.test b/test-suite/tests/encoding-iso88591.test index f7bec5e..8265ff1 100644 --- a/test-suite/tests/encoding-iso88591.test +++ b/test-suite/tests/encoding-iso88591.test @@ -106,16 +106,16 @@ (with-test-prefix "string length" (pass-if "ltima" - (eq? (string-length s1) 6)) + (eqv? (string-length s1) 6)) (pass-if "cdula" - (eq? (string-length s2) 6)) + (eqv? (string-length s2) 6)) (pass-if "aos" - (eq? (string-length s3) 4)) + (eqv? (string-length s3) 4)) (pass-if "Cmo?" - (eq? (string-length s4) 6))) + (eqv? (string-length s4) 6))) (with-test-prefix "internal encoding" @@ -168,7 +168,7 @@ (pass-if "1" (let (( 1) ( 2)) - (eq? (+ ) 3)))) + (eqv? (+ ) 3)))) (with-test-prefix "output errors" diff --git a/test-suite/tests/encoding-iso88597.test b/test-suite/tests/encoding-iso88597.test index f116194..a577b2a 100644 --- a/test-suite/tests/encoding-iso88597.test +++ b/test-suite/tests/encoding-iso88597.test @@ -95,16 +95,16 @@ (with-test-prefix "string length" (pass-if "s1" - (eq? (string-length s1) 4)) + (eqv? (string-length s1) 4)) (pass-if "s2" - (eq? (string-length s2) 3)) + (eqv? (string-length s2) 3)) (pass-if "s3" - (eq? (string-length s3) 8)) + (eqv? (string-length s3) 8)) (pass-if "s4" - (eq? (string-length s4) 3))) + (eqv? (string-length s4) 3))) (with-test-prefix "internal encoding" @@ -157,7 +157,7 @@ (pass-if "1" (let (( 1) ( 2)) - (eq? (+ ) 3)))) + (eqv? (+ ) 3)))) (with-test-prefix "output errors" diff --git a/test-suite/tests/encoding-utf8.test b/test-suite/tests/encoding-utf8.test index 966a04d..1de3fa7 100644 --- a/test-suite/tests/encoding-utf8.test +++ b/test-suite/tests/encoding-utf8.test @@ -126,16 +126,16 @@ (with-test-prefix "string length" (pass-if "última" - (eq? (string-length s1) 6)) + (eqv? (string-length s1) 6)) (pass-if "cédula" - (eq? (string-length s2) 6)) + (eqv? (string-length s2) 6)) (pass-if "años" - (eq? (string-length s3) 4)) + (eqv? (string-length s3) 4)) (pass-if "羅生門" - (eq? (string-length s4) 3))) + (eqv? (string-length s4) 3))) (with-test-prefix "internal encoding" @@ -188,7 +188,7 @@ (pass-if "1" (let ((芥川龍之介 1) (ñ 2)) - (eq? (+ 芥川龍之介 ñ) 3)))) + (eqv? (+ 芥川龍之介 ñ) 3)))) (if (defined? 'setlocale) (setlocale LC_ALL oldlocale)) diff --git a/test-suite/tests/hash.test b/test-suite/tests/hash.test index cb6b5cc..3bd4004 100644 --- a/test-suite/tests/hash.test +++ b/test-suite/tests/hash.test @@ -134,7 +134,7 @@ (with-output-to-string (lambda () (write table))))))) - ;; 1 and 1 are equal? and eqv? and eq? + ;; 1 and 1 are equal? and eqv? (but not necessarily eq?) (pass-if (equal? 'foo (let ((table (make-hash-table))) (hash-set! table 1 'foo) @@ -143,10 +143,6 @@ (let ((table (make-hash-table))) (hashv-set! table 1 'foo) (hashv-ref table 1)))) - (pass-if (equal? 'foo - (let ((table (make-hash-table))) - (hashq-set! table 1 'foo) - (hashq-ref table 1)))) ;; 1/2 and 2/4 are equal? and eqv? (but not necessarily eq?) (pass-if (equal? 'foo diff --git a/test-suite/tests/i18n.test b/test-suite/tests/i18n.test index ef08dd4..ad65b73 100644 --- a/test-suite/tests/i18n.test +++ b/test-suite/tests/i18n.test @@ -255,30 +255,30 @@ (with-test-prefix "character mapping" (pass-if "char-locale-downcase" - (and (eq? #\a (char-locale-downcase #\A)) - (eq? #\a (char-locale-downcase #\A (make-locale LC_ALL "C"))))) + (and (eqv? #\a (char-locale-downcase #\A)) + (eqv? #\a (char-locale-downcase #\A (make-locale LC_ALL "C"))))) (pass-if "char-locale-upcase" - (and (eq? #\Z (char-locale-upcase #\z)) - (eq? #\Z (char-locale-upcase #\z (make-locale LC_ALL "C"))))) + (and (eqv? #\Z (char-locale-upcase #\z)) + (eqv? #\Z (char-locale-upcase #\z (make-locale LC_ALL "C"))))) (pass-if "char-locale-titlecase" - (and (eq? #\T (char-locale-titlecase #\t)) - (eq? #\T (char-locale-titlecase #\t (make-locale LC_ALL "C"))))) + (and (eqv? #\T (char-locale-titlecase #\t)) + (eqv? #\T (char-locale-titlecase #\t (make-locale LC_ALL "C"))))) (pass-if "char-locale-titlecase Dž" - (and (eq? #\762 (char-locale-titlecase #\763)) - (eq? #\762 (char-locale-titlecase #\763 (make-locale LC_ALL "C"))))) + (and (eqv? #\762 (char-locale-titlecase #\763)) + (eqv? #\762 (char-locale-titlecase #\763 (make-locale LC_ALL "C"))))) (pass-if "char-locale-upcase Turkish" (under-turkish-utf8-locale-or-unresolved (lambda () - (eq? #\İ (char-locale-upcase #\i %turkish-utf8-locale))))) + (eqv? #\İ (char-locale-upcase #\i %turkish-utf8-locale))))) (pass-if "char-locale-downcase Turkish" (under-turkish-utf8-locale-or-unresolved (lambda () - (eq? #\i (char-locale-downcase #\İ %turkish-utf8-locale)))))) + (eqv? #\i (char-locale-downcase #\İ %turkish-utf8-locale)))))) (with-test-prefix "string mapping" diff --git a/test-suite/tests/modules.test b/test-suite/tests/modules.test index 79e3c98..fb54061 100644 --- a/test-suite/tests/modules.test +++ b/test-suite/tests/modules.test @@ -345,7 +345,7 @@ (set-module-binder! m (lambda args (set! invoked? #t) #f)) (module-define! m 'something 2) (and invoked? - (eq? (module-ref m 'something) 2)))) + (eqv? (module-ref m 'something) 2)))) (pass-if "honored (ref)" (let ((m (make-module)) diff --git a/test-suite/tests/ports.test b/test-suite/tests/ports.test index 613d269..3729930 100644 --- a/test-suite/tests/ports.test +++ b/test-suite/tests/ports.test @@ -482,7 +482,7 @@ (display str)))) #f) ; so the test really fails here (lambda (key subr message errno port chr) - (and (eq? chr #\ĉ) + (and (eqv? chr #\ĉ) (string? (strerror errno))))))) (pass-if "wrong encoding, substitute" @@ -548,12 +548,12 @@ ((_ port (proc -> error)) (if (eq? 'substitute (port-conversion-strategy port)) - (eq? (proc port) #\?) + (eqv? (proc port) #\?) (decoding-error? port (proc port)))) ((_ port (proc -> eof)) (eof-object? (proc port))) ((_ port (proc -> char)) - (eq? (proc port) char)))) + (eqv? (proc port) char)))) (make-checks (syntax-rules () ((_ port check ...) @@ -1136,7 +1136,7 @@ (display "This is GNU Guile.\nWelcome." p))) (call-with-input-file (test-file) (lambda (p) - (and (eq? #\T (read-char p)) + (and (eqv? #\T (read-char p)) (let ((line (port-line p)) (col (port-column p))) (and (= line 0) (= col 1) diff --git a/test-suite/tests/srfi-35.test b/test-suite/tests/srfi-35.test index 6d725dc..5e4cb27 100644 --- a/test-suite/tests/srfi-35.test +++ b/test-suite/tests/srfi-35.test @@ -65,17 +65,17 @@ (pass-if "condition-ref" (let* ((ct (make-condition-type 'chbouib &condition '(a b))) (c (make-condition ct 'b 1 'a 0))) - (and (eq? (condition-ref c 'a) 0) - (eq? (condition-ref c 'b) 1)))) + (and (eqv? (condition-ref c 'a) 0) + (eqv? (condition-ref c 'b) 1)))) (pass-if "condition-ref with inheritance" (let* ((top (make-condition-type 'foo &condition '(a b))) (ct (make-condition-type 'bar top '(c d))) (c (make-condition ct 'b 1 'a 0 'd 3 'c 2))) - (and (eq? (condition-ref c 'a) 0) - (eq? (condition-ref c 'b) 1) - (eq? (condition-ref c 'c) 2) - (eq? (condition-ref c 'd) 3)))) + (and (eqv? (condition-ref c 'a) 0) + (eqv? (condition-ref c 'b) 1) + (eqv? (condition-ref c 'c) 2) + (eqv? (condition-ref c 'd) 3)))) (pass-if "extract-condition" (let* ((ct (make-condition-type 'chbouib &condition '(a b))) @@ -149,8 +149,8 @@ (let ((c (make-condition &chbouib 'one 1 'two 2))) (and (condition? c) (chbouib? c) - (eq? (chbouib-one c) 1) - (eq? (chbouib-two c) 2)))) + (eqv? (chbouib-one c) 1) + (eqv? (chbouib-two c) 2)))) m))) (pass-if "condition" diff --git a/test-suite/tests/vlist.test b/test-suite/tests/vlist.test index d939284..a37be5e 100644 --- a/test-suite/tests/vlist.test +++ b/test-suite/tests/vlist.test @@ -287,12 +287,12 @@ ;; using the supplied hash procedure, which could lead to ;; inconsistencies. (let* ((s "hello") - (vh (fold vhash-consq - (vhash-consq s "world" vlist-null) + (vh (fold vhash-consv + (vhash-consv s "world" vlist-null) (iota 300) (iota 300)))) - (and (vhash-assq s vh) - (pair? (vhash-assq s (vhash-delete 123 vh eq? hashq)))))) + (and (vhash-assv s vh) + (pair? (vhash-assv s (vhash-delete 123 vh eqv? hashv)))))) (pass-if "vhash-fold" (let* ((keys '(a b c d e f g d h i)) -- 1.7.10.4 From unknown Sun Jun 22 00:11:41 2025 X-Loop: help-debbugs@gnu.org Subject: bug#13741: [PATCH] test-suite: eq-ness of numbers, characters is unspecified Resent-From: Daniel Hartwig Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-guile@gnu.org Resent-Date: Tue, 19 Feb 2013 04:31:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 13741 X-GNU-PR-Package: guile X-GNU-PR-Keywords: To: 13741@debbugs.gnu.org Received: via spool by 13741-submit@debbugs.gnu.org id=B13741.136124823119486 (code B ref 13741); Tue, 19 Feb 2013 04:31:01 +0000 Received: (at 13741) by debbugs.gnu.org; 19 Feb 2013 04:30:31 +0000 Received: from localhost ([127.0.0.1]:35693 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U7eqc-00054F-1v for submit@debbugs.gnu.org; Mon, 18 Feb 2013 23:30:31 -0500 Received: from mail-ia0-f175.google.com ([209.85.210.175]:64216) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U7eqZ-000547-Sp for 13741@debbugs.gnu.org; Mon, 18 Feb 2013 23:30:28 -0500 Received: by mail-ia0-f175.google.com with SMTP id r4so5640977iaj.6 for <13741@debbugs.gnu.org>; Mon, 18 Feb 2013 20:29:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:content-type:content-transfer-encoding; bh=c09RCQkQlCzuyrRmQ2/MeZ29fuF8P0toKy0Nr+yCjSU=; b=FTT8+yCYrT2ZOONFTavHKgiSTqBhqwwJMQpB2coT4yeLvw3DODU0la/IFEmkQ4SRD4 cFRXrbpRdoOWfbkP1jx/6FK5KwyYkTftNttFq0Evg+yQvkTBsIUFDcPDyMQYdum64x6n PNX5nqSBJSeYta0nlb3YLXEMNfZ6XJGiq00CoDKLJ3YW+tbiCBlB/Ha0NUx2exKBROL8 jQQfLb6ng5DW3hLRxDaYN2jzdn8ACXVrwAIH97HwPGRMWC0nzz9LqWldSg9J9xU4uBQy /Rbqt+l/XqCRMpTn8UExnAxafBnr3NrRx1eyFM6yxkdEU4PH8QKyv/Ceyh1sqUax2RbO emRw== MIME-Version: 1.0 X-Received: by 10.50.187.225 with SMTP id fv1mr8596069igc.96.1361248163886; Mon, 18 Feb 2013 20:29:23 -0800 (PST) Received: by 10.64.76.51 with HTTP; Mon, 18 Feb 2013 20:29:23 -0800 (PST) In-Reply-To: <1361238914-14823-1-git-send-email-mandyke@gmail.com> References: <87ip5pnpyd.fsf@tines.lan> <1361238914-14823-1-git-send-email-mandyke@gmail.com> Date: Tue, 19 Feb 2013 12:29:23 +0800 Message-ID: From: Daniel Hartwig Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.1 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.2 (-) On 19 February 2013 09:55, Daniel Hartwig wrote: > * test-suite/tests/00-socket.test: > * test-suite/tests/alist.test: > * test-suite/tests/elisp.test: > * test-suite/tests/encoding-iso88591.test: > * test-suite/tests/encoding-iso88597.test: > * test-suite/tests/encoding-utf8.test: > * test-suite/tests/hash.test: > * test-suite/tests/i18n.test: > * test-suite/tests/modules.test: > * test-suite/tests/ports.test: > * test-suite/tests/srfi-35.test: Make tests use eqv? instead of eq? when > comparing numbers, characters. Checked also for similar uses of > assq[-ref]. > > * test-suite/tests/vlist.test ("vhash-delete honors HASH"): Change test > to use eqv-ness, not eq-ness, which should not impact its purpose as > these two are equivalent for strings. Located using grep and inspecting each occurance of eq?, assq, consq. The tests weren't necessarily failing, just incorrect for their reliance on unspecified results. Most checks involving numbers were already using eqv?, equal?, or =3D. The following were spotted but have been left alone for now: * list.test (diff-unrolled): Uses eq? internally, called on lists with numbers. * tree-il.test: * elisp.test ("assq"): Is that correct for Guile's elisp? _(elisp) Comparison of Numbers_ says that each integer does have a unique object in Emacs Lisp, and using =E2=80=98eq=E2=80=99 is valid though not recommended. Regards From unknown Sun Jun 22 00:11:41 2025 X-Loop: help-debbugs@gnu.org Subject: bug#13741: [PATCH] test-suite: eq-ness of numbers, characters is unspecified Resent-From: Mark H Weaver Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-guile@gnu.org Resent-Date: Tue, 19 Feb 2013 05:21:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 13741 X-GNU-PR-Package: guile X-GNU-PR-Keywords: To: Daniel Hartwig Cc: 13741@debbugs.gnu.org Received: via spool by 13741-submit@debbugs.gnu.org id=B13741.136125123223775 (code B ref 13741); Tue, 19 Feb 2013 05:21:02 +0000 Received: (at 13741) by debbugs.gnu.org; 19 Feb 2013 05:20:32 +0000 Received: from localhost ([127.0.0.1]:35755 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U7fd2-0006BQ-5k for submit@debbugs.gnu.org; Tue, 19 Feb 2013 00:20:32 -0500 Received: from world.peace.net ([96.39.62.75]:49919) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U7fd0-0006BJ-Rv for 13741@debbugs.gnu.org; Tue, 19 Feb 2013 00:20:31 -0500 Received: from 209-6-91-212.c3-0.smr-ubr1.sbo-smr.ma.cable.rcn.com ([209.6.91.212] helo=tines.lan) by world.peace.net with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.72) (envelope-from ) id 1U7fbs-0000Tb-I0; Tue, 19 Feb 2013 00:19:20 -0500 From: Mark H Weaver References: <87ip5pnpyd.fsf@tines.lan> <1361238914-14823-1-git-send-email-mandyke@gmail.com> Date: Tue, 19 Feb 2013 00:19:12 -0500 In-Reply-To: <1361238914-14823-1-git-send-email-mandyke@gmail.com> (Daniel Hartwig's message of "Tue, 19 Feb 2013 09:55:14 +0800") Message-ID: <87bobgop7z.fsf@tines.lan> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) Daniel Hartwig writes: > * test-suite/tests/00-socket.test: > * test-suite/tests/alist.test: > * test-suite/tests/elisp.test: > * test-suite/tests/encoding-iso88591.test: > * test-suite/tests/encoding-iso88597.test: > * test-suite/tests/encoding-utf8.test: > * test-suite/tests/hash.test: > * test-suite/tests/i18n.test: > * test-suite/tests/modules.test: > * test-suite/tests/ports.test: > * test-suite/tests/srfi-35.test: Make tests use eqv? instead of eq? when > comparing numbers, characters. Checked also for similar uses of > assq[-ref]. > > * test-suite/tests/vlist.test ("vhash-delete honors HASH"): Change test > to use eqv-ness, not eq-ness, which should not impact its purpose as > these two are equivalent for strings. I think we should apply this patch. Although we can currently rely on 'eq?' working properly for fixnums and characters in Guile, misuse of 'eq?' is widespread, and our misuse of it in our own code contributes to the confusion. IMO we should set a better example. What do other people think? Mark From unknown Sun Jun 22 00:11:41 2025 X-Loop: help-debbugs@gnu.org Subject: bug#13741: [PATCH] test-suite: eq-ness of numbers, characters is unspecified Resent-From: Mark H Weaver Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-guile@gnu.org Resent-Date: Fri, 01 Mar 2013 16:13:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 13741 X-GNU-PR-Package: guile X-GNU-PR-Keywords: To: Daniel Hartwig Cc: 13741@debbugs.gnu.org Received: via spool by 13741-submit@debbugs.gnu.org id=B13741.136215435115483 (code B ref 13741); Fri, 01 Mar 2013 16:13:01 +0000 Received: (at 13741) by debbugs.gnu.org; 1 Mar 2013 16:12:31 +0000 Received: from localhost ([127.0.0.1]:58330 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UBSZR-00041e-4B for submit@debbugs.gnu.org; Fri, 01 Mar 2013 11:12:30 -0500 Received: from world.peace.net ([96.39.62.75]:41001) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UBSZO-00041W-Jd for 13741@debbugs.gnu.org; Fri, 01 Mar 2013 11:12:27 -0500 Received: from 209-6-91-212.c3-0.smr-ubr1.sbo-smr.ma.cable.rcn.com ([209.6.91.212] helo=tines.lan) by world.peace.net with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.72) (envelope-from ) id 1UBSXI-000596-ES; Fri, 01 Mar 2013 11:10:16 -0500 From: Mark H Weaver References: <87ip5pnpyd.fsf@tines.lan> <1361238914-14823-1-git-send-email-mandyke@gmail.com> <87bobgop7z.fsf@tines.lan> Date: Fri, 01 Mar 2013 11:10:03 -0500 In-Reply-To: <87bobgop7z.fsf@tines.lan> (Mark H. Weaver's message of "Tue, 19 Feb 2013 00:19:12 -0500") Message-ID: <87bob3umn8.fsf@tines.lan> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.8 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -0.5 (/) I wrote: > Daniel Hartwig writes: >> * test-suite/tests/00-socket.test: >> * test-suite/tests/alist.test: >> * test-suite/tests/elisp.test: >> * test-suite/tests/encoding-iso88591.test: >> * test-suite/tests/encoding-iso88597.test: >> * test-suite/tests/encoding-utf8.test: >> * test-suite/tests/hash.test: >> * test-suite/tests/i18n.test: >> * test-suite/tests/modules.test: >> * test-suite/tests/ports.test: >> * test-suite/tests/srfi-35.test: Make tests use eqv? instead of eq? when >> comparing numbers, characters. Checked also for similar uses of >> assq[-ref]. >> >> * test-suite/tests/vlist.test ("vhash-delete honors HASH"): Change test >> to use eqv-ness, not eq-ness, which should not impact its purpose as >> these two are equivalent for strings. > > I think we should apply this patch. Although we can currently rely on > 'eq?' working properly for fixnums and characters in Guile, misuse of > 'eq?' is widespread, and our misuse of it in our own code contributes to > the confusion. IMO we should set a better example. > > What do other people think? Having heard no objections over 10 days, I went ahead and pushed this. Thanks! Mark From unknown Sun Jun 22 00:11:41 2025 X-Loop: help-debbugs@gnu.org Subject: bug#13741: guile-2.0: optimize, and eq-ness of literals (test-suite) Resent-From: Mark H Weaver Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-guile@gnu.org Resent-Date: Fri, 01 Mar 2013 16:16:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 13741 X-GNU-PR-Package: guile X-GNU-PR-Keywords: To: Daniel Hartwig Cc: Ludovic =?UTF-8?Q?Court=C3=A8s?= , 13741@debbugs.gnu.org Received: via spool by 13741-submit@debbugs.gnu.org id=B13741.136215453815796 (code B ref 13741); Fri, 01 Mar 2013 16:16:01 +0000 Received: (at 13741) by debbugs.gnu.org; 1 Mar 2013 16:15:38 +0000 Received: from localhost ([127.0.0.1]:58339 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UBScS-00046g-8X for submit@debbugs.gnu.org; Fri, 01 Mar 2013 11:15:38 -0500 Received: from world.peace.net ([96.39.62.75]:41003) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UBScP-00046Y-Mp for 13741@debbugs.gnu.org; Fri, 01 Mar 2013 11:15:35 -0500 Received: from 209-6-91-212.c3-0.smr-ubr1.sbo-smr.ma.cable.rcn.com ([209.6.91.212] helo=tines.lan) by world.peace.net with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.72) (envelope-from ) id 1UBSaL-0005AF-3y; Fri, 01 Mar 2013 11:13:25 -0500 From: Mark H Weaver References: <87621q8fo4.fsf@gmail.com> <87k3q67zhy.fsf@gnu.org> Date: Fri, 01 Mar 2013 11:13:17 -0500 In-Reply-To: (Daniel Hartwig's message of "Mon, 18 Feb 2013 18:02:15 +0800") Message-ID: <877glrumhu.fsf@tines.lan> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.8 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -0.5 (/) Daniel Hartwig writes: > On 18 February 2013 17:16, Ludovic Court=C3=A8s wrote: >> Quoth R5RS: >> >> `Eq?''s behavior on numbers and characters is >> implementation-dependent, but it will always return either true or >> false, and will return true only when `eqv?' would also return >> true. `Eq?' may also behave differently from `eqv?' on empty >> vectors and empty strings. >> >> What we may get wrong is that it looks as if it doesn=E2=80=99t always r= eturn >> either true or false, because the behavior depends on whether one of the >> operands is a literal. > > I took that to mean only that eq? always returns a boolean, rather > than requiring it to return the same boolean given the same numeric > arguments. It would be fine to simplify some rationals and not > others, as this action does not affect the outcome of eqv?. Yes, this is my understanding as well. Mark