From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: taylanbayirli@gmail.com ("Taylan Ulrich =?UTF-8?Q?Bay=C4=B1rl=C4=B1/Kammer?=") Newsgroups: gmane.lisp.guile.bugs Subject: bug#22449: (rnrs hashtables): Mutation of immutable hashtable ignored Date: Sat, 23 Jan 2016 23:57:03 +0100 Message-ID: <87y4bfkips.fsf@T420.taylan> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1453589595 21568 80.91.229.3 (23 Jan 2016 22:53:15 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 23 Jan 2016 22:53:15 +0000 (UTC) To: 22449@debbugs.gnu.org Original-X-From: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Sat Jan 23 23:53:09 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 1aN73K-00080B-Gp for guile-bugs@m.gmane.org; Sat, 23 Jan 2016 23:53:06 +0100 Original-Received: from localhost ([::1]:58769 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aN73K-0006pa-4W for guile-bugs@m.gmane.org; Sat, 23 Jan 2016 17:53:06 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:37454) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aN73H-0006pU-4F for bug-guile@gnu.org; Sat, 23 Jan 2016 17:53:03 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aN73G-0002bj-6h for bug-guile@gnu.org; Sat, 23 Jan 2016 17:53:03 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:44407) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aN73G-0002bX-2u for bug-guile@gnu.org; Sat, 23 Jan 2016 17:53:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84) (envelope-from ) id 1aN73F-0001Qe-SD for bug-guile@gnu.org; Sat, 23 Jan 2016 17:53:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: taylanbayirli@gmail.com ("Taylan Ulrich =?UTF-8?Q?Bay=C4=B1rl=C4=B1/Kammer?=") Original-Sender: "Debbugs-submit" Resent-CC: bug-guile@gnu.org Resent-Date: Sat, 23 Jan 2016 22:53:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 22449 X-GNU-PR-Package: guile X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-guile@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.14535895685470 (code B ref -1); Sat, 23 Jan 2016 22:53:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 23 Jan 2016 22:52:48 +0000 Original-Received: from localhost ([127.0.0.1]:60860 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aN732-0001QA-Gs for submit@debbugs.gnu.org; Sat, 23 Jan 2016 17:52:48 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:46055) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aN731-0001Pu-5b for submit@debbugs.gnu.org; Sat, 23 Jan 2016 17:52:47 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aN72v-0002Ot-6f for submit@debbugs.gnu.org; Sat, 23 Jan 2016 17:52:41 -0500 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:60774) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aN72v-0002On-3l for submit@debbugs.gnu.org; Sat, 23 Jan 2016 17:52:41 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:36976) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aN72u-0006QV-0D for bug-guile@gnu.org; Sat, 23 Jan 2016 17:52:41 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aN72t-0002Nb-4d for bug-guile@gnu.org; Sat, 23 Jan 2016 17:52:39 -0500 Original-Received: from mail-wm0-x22a.google.com ([2a00:1450:400c:c09::22a]:38379) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aN72s-0002NU-UJ for bug-guile@gnu.org; Sat, 23 Jan 2016 17:52:39 -0500 Original-Received: by mail-wm0-x22a.google.com with SMTP id b14so29916759wmb.1 for ; Sat, 23 Jan 2016 14:52:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:message-id:from:to:subject:mime-version:content-type :content-transfer-encoding; bh=WCbgM5+7ZTqNhnz1W7x/QpktNQH1UtRKBIiJazK/NcE=; b=FgA3RlJgbP9e5WDJdqBZJc+ZTEi8W9iVsvZsn1tUK6B/2hXD5VExSDLaQilm6cJSRJ VrLAbMhV3Nhc1mOw3/NPTlQYNg79MuNzSrdylBcQOG2ygcjJKp1Qo2LJeCenf8ZAM73W W8d1tGJ/CY6N6xDE2mrxzpWrLSu0knPtP/EuHdZSLJEOxZnODsTyxvvA9gV5P6PGUsnj kIsrOHl9odzGTtspDHGN+B0T07aE2sfwFaiF+QSbsVnxv2n0ZFaLk2IaoCGCy3+n1LvN 7F08+p/A0mAOAJgwb3yHgSijbm7kKFkuis3TRVPaUiyVtLoEqvqCsOL1oTKYHWm32Tdr Qrhg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:message-id:from:to:subject:mime-version :content-type:content-transfer-encoding; bh=WCbgM5+7ZTqNhnz1W7x/QpktNQH1UtRKBIiJazK/NcE=; b=hzovCZglq0GFzrC3CjBfsZGLxwMA06hGoq3cy7uZxP2XQSICYCQ/DJVhzLLxiS36EM TOa/CWxcNrox8uwMiRuOj0N/SI8VeEz0R+P6LsIF3eO4hgn4iLKBXVm7zoyM3Exhp5QN hvqmOQ1w9hKJucjjrTi86JmkoYdcbXMwFnrzBVBTyH2PRB8zTEsyQUqBgKg3MrRsGYhd VpurJ/DCyYXDazWhfQnjU2EgktHgR9EbLPrAaE8mSXtqm/HMxaX83ir0f01PyH4zsf/W rWiMMfXSLWyVt+xMlVPZJghzawqzIZQ/FFGQIaClKYgvMKubonzjTdhLAZO5jwVFk2dY gLEQ== X-Gm-Message-State: AG10YOQ5StzypETxFGIFnUsP1fZ5BHJTvJocg37l3d7BY0RMsh4fIQzAfvLIJxbW4vTyYQ== X-Received: by 10.195.18.5 with SMTP id gi5mr9874881wjd.167.1453589558091; Sat, 23 Jan 2016 14:52:38 -0800 (PST) Original-Received: from T420.taylan ([2a02:908:c30:3ec0:221:ccff:fe66:68f0]) by smtp.gmail.com with ESMTPSA id cs4sm12130991wjc.10.2016.01.23.14.52.36 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 23 Jan 2016 14:52:36 -0800 (PST) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x 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-bounces+guile-bugs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.bugs:7941 Archived-At: I couldn't find explicit wording in R6RS on what should happen, but I would generally expect an attempt to mutate an immutable object to raise an error. In Guile, (hashtable-set! (hashtable-copy (make-eq-hashtable)) 'foo 'bar) is silently ignored. Attached is a simple patch that raises an assertion violation when the hashtable is immutable. Taylan ===File /home/taylan/src/guile/guile-stable-2.0/0001-Hashtable-set-errors-on-immutable-hashtable.patch=== >From dd6c4bbbe85a57fcbb08bdc7847075bddc1f0d87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Taylan=20Ulrich=20Bay=C4=B1rl=C4=B1/Kammer?= Date: Sat, 23 Jan 2016 22:35:24 +0100 Subject: [PATCH] Hashtable-set! errors on immutable hashtable. * module/rnrs/hashtables.scm (hashtable-set!): Raise an assertion violation error when the hashtable is immutable. --- module/rnrs/hashtables.scm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/module/rnrs/hashtables.scm b/module/rnrs/hashtables.scm index 98d2d76..5773eb1 100644 --- a/module/rnrs/hashtables.scm +++ b/module/rnrs/hashtables.scm @@ -122,8 +122,9 @@ (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 obj) + (assertion-violation + 'hashtable-set! "Hashtable is immutable." hashtable))) (define (hashtable-delete! hashtable key) (if (r6rs:hashtable-mutable? hashtable) -- 2.6.3 ============================================================