Daniel Llorens <daniel.llor...@bluewin.ch> writes:

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

I agree.  Even from a strictly logical standpoint, if we define
"scm_TYPE_writable_elements" to mean "forall elements X in the object, X
is mutable", then that statement is certainly true if there are no
elements in the object.

> Let me know if you disagree, otherwise I'll submit a patch. 

Sounds good, thanks!

      Mark

Reply via email to