From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Daniel Llorens Newsgroups: gmane.lisp.guile.devel Subject: _writable_elements & empty vectors Date: Mon, 11 Sep 2017 13:57:18 +0200 Message-ID: <4F48E2ED-D196-48F1-A012-3364A9104555@bluewin.ch> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\)) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1505131103 13401 195.159.176.226 (11 Sep 2017 11:58:23 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 11 Sep 2017 11:58:23 +0000 (UTC) To: guile-devel Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Mon Sep 11 13:58:18 2017 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1drNLj-0002KL-DC for guile-devel@m.gmane.org; Mon, 11 Sep 2017 13:57:59 +0200 Original-Received: from localhost ([::1]:57035 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1drNLp-0006j3-4w for guile-devel@m.gmane.org; Mon, 11 Sep 2017 07:58:05 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:60947) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1drNLE-0006I5-Vc for guile-devel@gnu.org; Mon, 11 Sep 2017 07:57:30 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1drNLB-0002DR-0c for guile-devel@gnu.org; Mon, 11 Sep 2017 07:57:29 -0400 Original-Received: from vimdzmsp-sfwd02.bluewin.ch ([195.186.227.131]:56206 helo=smtpauths.lb.bluewin.ch) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1drNLA-0002Ab-PZ for guile-devel@gnu.org; Mon, 11 Sep 2017 07:57:24 -0400 Original-Received: from [10.42.0.159] ([213.193.80.99]) by vimdzmsp-sfwd02.bluewin.ch Swisscom AG with SMTP id rNL6d6ylC1i6KrNL6dy4SQ; Mon, 11 Sep 2017 13:57:21 +0200 X-Bluewin-Spam-Analysis: v=2.1 cv=bM/bWKKZ c=1 sm=1 tr=0 a=DzaHVtLsrNCQ5PccsnG91A==:117 a=DzaHVtLsrNCQ5PccsnG91A==:17 a=L9H7d07YOLsA:10 a=9cW_t1CCXrUA:10 a=s5jvgZ67dGcA:10 a=kj9zAlcOel0A:10 a=mDV3o1hIAAAA:8 a=ls0Zn9JF-8Lc5TaD8qkA:9 a=CjuIK1q_8ugA:10 a=IUsDkBEYBlcA:10 a=_FVE-zBwftR9WsbkzFJk:22 X-Bluewin-Spam-Score: 0.00 X-FXIT-IP: IPv4[213.193.80.99] Epoch[1505131041] X-Bluewin-AuthAs: dll@bluewin.ch X-Mailer: Apple Mail (2.1878.6) X-CMAE-Envelope: MS4wfKHAukmgJ5rvPOH+efCVlx4zTsYAwzFHY1ZiPBpDTZH32tfwYVYUylJgSFCbVwDJvBsHMRVnkxoR6g1OAiBuUgPjR65yWAyQj4+X9Y/R48odmwIObIy5 prVe3ps5Pc8sbSGAijEFPbll3Fy+hYQGZbLfsoXgQZQMiU9LKiLMJW18o5pMcdlB9ZNkxvK8HZQrJw== X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 195.186.227.131 X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Original-Sender: "guile-devel" Xref: news.gmane.org gmane.lisp.guile.devel:19287 Archived-At: There is a whole set of functions scm_TYPE_writable_elements in Guile. = In 2.2 these functions must be called with mutable containers. The problem is that empty vectors or arrays are immutable, so one is = forced to guard every call to scm_TYPE_writable_elements with a = superfluous size check. E.g. (vector 1 2) -> new mutable vector (vector 1) -> new mutable vector (vector) -> const non-mutable vector This causes (sort! (vector) <) to fail in Guile 2.2. I think scm_TYPE_writable_elements should accept empty vectors whether = they're technically mutable or not, and return NULL. Let me know if you disagree, otherwise I'll submit a patch.=20 Regards Daniel PS Please also review/ack the patchset at wip-exception-truncate, except = for the last patch which is a temporary hack = (http://git.savannah.gnu.org/gitweb/?p=3Dguile.git;a=3Dshortlog;h=3Drefs/h= eads/wip-exception-truncate). I've already submitted this patchset to the list in the format-patch = style, actually I've submitted it twice (second time = https://lists.gnu.org/archive/html/guile-devel/2017-02/msg00046.html), = but I can do it again, if it helps. I've rebased the patchset on top of = stable-2.2 and I've also updated it to fix the bug in (sort!) by = checking argument sizes.=20