unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Daniel Llorens <daniel.llorens@bluewin.ch>
To: guile-devel <guile-devel@gnu.org>
Subject: _writable_elements & empty vectors
Date: Mon, 11 Sep 2017 13:57:18 +0200	[thread overview]
Message-ID: <4F48E2ED-D196-48F1-A012-3364A9104555@bluewin.ch> (raw)


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. 

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=guile.git;a=shortlog;h=refs/heads/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. 





             reply	other threads:[~2017-09-11 11:57 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-11 11:57 Daniel Llorens [this message]
2017-09-14 21:35 ` _writable_elements & empty vectors Mark H Weaver

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4F48E2ED-D196-48F1-A012-3364A9104555@bluewin.ch \
    --to=daniel.llorens@bluewin.ch \
    --cc=guile-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).