Have some routines that are not call/cc safe? Specific proposal at bottom of email Bradley Lucier 04 Aug 2022 21:18 UTC

Any comments about code refer to this branch:

https://github.com/gambiteer/srfi-231/tree/call-cc-safe

Perhaps there can be a few routines that are not thread and call/cc safe.

1.

(array-copy! array [storage-class [mutable? [safe?]]])

Naive implementation---allocate the new array and copy elements to it as
they are computed, so it is not thread safe nor call/cc safe.  Note: the
current implementation of array-copy already does this when safe to do
so, i.e., when the argument is a specialized array.

Comment: Right now, array-assign! is call/cc safe, it copies the source
array if necessary before assigning it to the destination.  Perhaps it,
too, could just assign elements as they are computed.

2.

(array-eager-map! f array [storage-class [mutable? [safe?]]])

Computes the elements of (array-map f array) one by one and stores them
in the output specialized array.  Equivalent to

(array-copy! (array-map f array) [storage-class [mutable? [safe?]]])

and there could be others.

Or perhaps what one needs is a routine

(array->specialized-array! array [storage-class [mutable? [safe?])

(needs a better name), which, when passed a specialized array, returns
it immediately, and when passed a generalized array copies it with
array-copy!.

Perhaps the most helpful and simplest thing would be to provide
array-copy! and leave it at that.  If the programmer does not use
call/cc it will work fine.

Proposal:

Implement array-copy!, and possibly make array-assign! non-call/cc-safe.

Brad

PS:  Marc Nieper-Wißkirchen recommended something similar earlier.