On Sun, May 28, 2023 at 8:45 PM Alex Shinn <[email protected]> wrote:

I'm not sure I understand this analogy.  What do you mean by safety here?
> A lazy random array will return different values for every element access
> to the original array.  A copy would produce one snapshot in time of this
> ever changing array.
>

My point is that you can't tell the difference between an array-copy of
such a random-values array (which need not be an array-map, any nonstrict
array can behave this way) and an array-copy! of it.  A time-consistent
snapshot of randomness is indistinguishable from a time-dependent
element-by-element copy of it.

This seems to be WAI.
>

I don't know what "WAI" is.


>   A "sufficiently smart compiler" could transform the idiom (array-copy
>> (array-map ...)) to use array-copy! instead.
>>
>
> Indeed, but in practice none of the implementations providing SRFI 231 do
> this now, and such optimizations are fragile
>

I'm not saying it should actually be done, merely that the bad behavior of
(array-copy (array-map ...)) can be counted by "Always use (array-copy!
(array-map ...)), because there is no demonstrable benefit to using
array-copy instead."

Reply via email to