[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

_writable_elements & empty vectors

From: Daniel Llorens
Subject: _writable_elements & empty vectors
Date: Mon, 11 Sep 2017 13:57:18 +0200

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.


(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. 



PS Please also review/ack the patchset at wip-exception-truncate, except for 
the last patch which is a temporary hack 

I've already submitted this patchset to the list in the format-patch style, 
actually I've submitted it twice (second time, 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 via email to

[Prev in Thread] Current Thread [Next in Thread]