From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Andy Wingo Newsgroups: gmane.lisp.guile.bugs Subject: bug#22447: (rnrs hashtables): Mutation of immutable hashtable ignored Date: Tue, 21 Jun 2016 09:47:29 +0200 Message-ID: <87k2hj3rvy.fsf@pobox.com> References: <87lh7fkhoq.fsf@T420.taylan> <87h9i3jj5y.fsf@T420.taylan> <8760t3qylt.fsf@T420.taylan> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1466495307 27057 80.91.229.3 (21 Jun 2016 07:48:27 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 21 Jun 2016 07:48:27 +0000 (UTC) Cc: 22447-done@debbugs.gnu.org To: taylanbayirli@gmail.com (Taylan Ulrich "=?UTF-8?Q?Bay=C4=B1rl=C4=B1/Kammer?=") Original-X-From: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Tue Jun 21 09:48:17 2016 Return-path: Envelope-to: guile-bugs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1bFGPu-0001vv-6M for guile-bugs@m.gmane.org; Tue, 21 Jun 2016 09:48:14 +0200 Original-Received: from localhost ([::1]:49450 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bFGPt-0002j1-EG for guile-bugs@m.gmane.org; Tue, 21 Jun 2016 03:48:13 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:60507) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bFGPl-0002bE-RZ for bug-guile@gnu.org; Tue, 21 Jun 2016 03:48:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bFGPi-00033j-MH for bug-guile@gnu.org; Tue, 21 Jun 2016 03:48:05 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:36141) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bFGPi-00033f-GP for bug-guile@gnu.org; Tue, 21 Jun 2016 03:48:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1bFGPi-0001a2-7H for bug-guile@gnu.org; Tue, 21 Jun 2016 03:48:02 -0400 Resent-From: Andy Wingo Original-Sender: "Debbugs-submit" Resent-To: bug-guile@gnu.org Resent-Date: Tue, 21 Jun 2016 07:48:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: cc-closed 22447 X-GNU-PR-Package: guile X-GNU-PR-Keywords: Mail-Followup-To: 22447@debbugs.gnu.org, wingo@pobox.com, taylanbayirli@gmail.com Original-Received: via spool by 22447-done@debbugs.gnu.org id=D22447.14664952616041 (code D ref 22447); Tue, 21 Jun 2016 07:48:01 +0000 Original-Received: (at 22447-done) by debbugs.gnu.org; 21 Jun 2016 07:47:41 +0000 Original-Received: from localhost ([127.0.0.1]:48478 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bFGPM-0001ZN-RN for submit@debbugs.gnu.org; Tue, 21 Jun 2016 03:47:41 -0400 Original-Received: from pb-sasl1.pobox.com ([64.147.108.66]:52890 helo=sasl.smtp.pobox.com) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bFGPL-0001ZD-Gk for 22447-done@debbugs.gnu.org; Tue, 21 Jun 2016 03:47:39 -0400 Original-Received: from sasl.smtp.pobox.com (unknown [127.0.0.1]) by pb-sasl1.pobox.com (Postfix) with ESMTP id 936661FFC5; Tue, 21 Jun 2016 03:47:37 -0400 (EDT) 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=Ibt5N6Io2I2r im65REc2P+HzOfY=; b=ggsY4WwFJgYU+ymxY389h5XBTPPEahRqQZYJ1bZ6YRpf 8NcvI5/Q5PHZJwgn2T4f8CaRZO/ect1yIBKznkUHatpw51RQ/SJ4m4MqbZM7cd8s Vo3lGF/yjo36hloeQCt2jfglOiameTGrumSrZAghjXbgyAg6NZY1zX1BmVlm58k= 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=Qk9QUf OMllUjpcY6pvAz4NsqaE+b5lvcSrkKOrX++ItmwAY7cNrAnzq7h/jPQos3mvlcRX MmsH4083pKw9OkJJaKkxqnkAXeT4+BUlHExhhWwSR0hdLNs8rTB3etC/MfpqF/tD 5HS+Bk5kvrOJLsQoKBpOwMCHBnvIPnNwa1MCo= Original-Received: from pb-sasl1.nyi.icgroup.com (unknown [127.0.0.1]) by pb-sasl1.pobox.com (Postfix) with ESMTP id 8C8981FFC4; Tue, 21 Jun 2016 03:47:37 -0400 (EDT) Original-Received: from clucks (unknown [88.160.190.192]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by pb-sasl1.pobox.com (Postfix) with ESMTPSA id D66ED1FFC3; Tue, 21 Jun 2016 03:47:36 -0400 (EDT) In-Reply-To: <8760t3qylt.fsf@T420.taylan> ("Taylan Ulrich \"=?UTF-8?Q?Bay=C4=B1rl=C4=B1/Kammer\?=""'s message of "Tue, 21 Jun 2016 00:33:50 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) X-Pobox-Relay-ID: 6C16A278-3784-11E6-A225-C1836462E9F6-02397024!pb-sasl1.pobox.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-guile@gnu.org List-Id: "Bug reports for GUILE, GNU's Ubiquitous Extension Language" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Original-Sender: "bug-guile" Xref: news.gmane.org gmane.lisp.guile.bugs:8060 Archived-At: Applied to master, thanks :) Andy On Tue 21 Jun 2016 00:33, taylanbayirli@gmail.com (Taylan Ulrich "Bay=C4=B1= rl=C4=B1/Kammer") writes: > Pinging this thread with a (very slightly) updated patch. :-) > > > From 7f35d515d711e255bba5a89a013d9d92034edf41 Mon Sep 17 00:00:00 2001 > From: =3D?UTF-8?q?Taylan=3D20Ulrich=3D20Bay=3DC4=3DB1rl=3DC4=3DB1/Kammer?= =3D > > Date: Tue, 21 Jun 2016 00:25:19 +0200 > Subject: [PATCH] Hashtable-set! errors on immutable hashtable. > > * module/rnrs/hashtables.scm (hashtable-set!): Raise an assertion > violation error when the hashtable is immutable. > * test-suite/tests/r6rs-hashtables.test: Fix accordingly. > --- > module/rnrs/hashtables.scm | 5 +++-- > test-suite/tests/r6rs-hashtables.test | 6 ++++-- > 2 files changed, 7 insertions(+), 4 deletions(-) > > diff --git a/module/rnrs/hashtables.scm b/module/rnrs/hashtables.scm > index 08f37e2..22bae7f 100644 > --- a/module/rnrs/hashtables.scm > +++ b/module/rnrs/hashtables.scm > @@ -127,8 +127,9 @@ >=20=20 > (define (hashtable-set! hashtable key obj) > (if (r6rs:hashtable-mutable? hashtable) > - (hash-table-set! (r6rs:hashtable-wrapped-table hashtable) key obj)) > - *unspecified*) > + (hash-table-set! (r6rs:hashtable-wrapped-table hashtable) key ob= j) > + (assertion-violation > + 'hashtable-set! "Hashtable is immutable." hashtable))) >=20=20 > (define (hashtable-delete! hashtable key) > (if (r6rs:hashtable-mutable? hashtable) > diff --git a/test-suite/tests/r6rs-hashtables.test b/test-suite/tests/r6r= s-hashtables.test > index fbc50c9..e2cbc2a 100644 > --- a/test-suite/tests/r6rs-hashtables.test > +++ b/test-suite/tests/r6rs-hashtables.test > @@ -20,6 +20,7 @@ > (define-module (test-suite test-rnrs-hashtable) > :use-module (ice-9 receive) > :use-module ((rnrs hashtables) :version (6)) > + :use-module ((rnrs exceptions) :version (6)) > :use-module (srfi srfi-1) > :use-module (test-suite lib)) >=20=20 > @@ -130,8 +131,9 @@ >=20=20 > (pass-if "hashtable-copy with mutability #f produces immutable copy" > (let ((copied-table (hashtable-copy (make-eq-hashtable) #f))) > - (hashtable-set! copied-table 'foo 1) > - (not (hashtable-ref copied-table 'foo #f)))))=20=20=20=20=20=20 > + (guard (exc (else #t)) > + (hashtable-set! copied-table 'foo 1) > + #f)))) >=20=20 > (with-test-prefix "hashtable-clear!" > (pass-if "hashtable-clear! removes all values from hashtable"