Re: Creating immutable specialized arrays
Bradley Lucier 20 Jan 2021 01:53 UTC
On 1/19/21 8:15 PM, John Cowan wrote:
> The changes for SRFI 179 mention that specialized arrays can now be
> immutable as well as mutable. However, there is no way to create such a
> thing directly: there is no argument to make-specialized-array for it,
> and the default mutability parameter is not respected either.
array-copy and list->array both return specialized arrays, which can be
chosen to be immutable.
make-specialized-array returns a new specialized array filed with the
default value for the specified storage class; it would not be useful to
make such an array immutable.
> We need to either remove the reference in the changes section or update
> both the specification (with a PFN) and the implementation. Note that
> you can in effect create an immutable specialized array by using
> array-map with the identity function.
If you use array-map with the identity function, you get what's called
in the document an immutable array, but it is not specialized (it
doesn't have a storage class or a body).
I don't see that the document needs to be changed, though.
Brad