Safe versus unsafe arrays Bradley Lucier (28 Jul 2023 21:52 UTC)
Re: Safe versus unsafe arrays Arthur A. Gleckler (28 Jul 2023 22:19 UTC)
Re: Safe versus unsafe arrays Marc Nieper-Wißkirchen (29 Jul 2023 05:58 UTC)
Re: Safe versus unsafe arrays Arthur A. Gleckler (29 Jul 2023 06:00 UTC)
Re: Safe versus unsafe arrays Bradley Lucier (13 Aug 2023 19:49 UTC)
Re: Safe versus unsafe arrays Marc Nieper-Wißkirchen (13 Aug 2023 19:59 UTC)
Re: Safe versus unsafe arrays John Cowan (29 Jul 2023 22:11 UTC)
Re: Safe versus unsafe arrays Marc Nieper-Wißkirchen (30 Jul 2023 07:41 UTC)
Re: Safe versus unsafe arrays John Cowan (30 Jul 2023 08:46 UTC)
Re: Safe versus unsafe arrays Marc Nieper-Wißkirchen (30 Jul 2023 09:00 UTC)
Re: Safe versus unsafe arrays Bradley Lucier (30 Jul 2023 20:39 UTC)
Re: Safe versus unsafe arrays Marc Nieper-Wißkirchen (30 Jul 2023 20:49 UTC)
Re: Safe versus unsafe arrays John Cowan (30 Jul 2023 21:37 UTC)
Re: Safe versus unsafe arrays Marc Nieper-Wißkirchen (31 Jul 2023 19:49 UTC)
Re: Safe versus unsafe arrays Bradley Lucier (12 Aug 2023 17:58 UTC)
Re: Safe versus unsafe arrays Marc Nieper-Wißkirchen (12 Aug 2023 18:09 UTC)
Re: Safe versus unsafe arrays John Cowan (12 Aug 2023 19:22 UTC)

Re: Safe versus unsafe arrays Marc Nieper-Wißkirchen 30 Jul 2023 09:00 UTC

Am So., 30. Juli 2023 um 10:46 Uhr schrieb John Cowan <xxxxxx@ccil.org>:
>
>
>
> On Sun, Jul 30, 2023 at 3:40 AM Marc Nieper-Wißkirchen <xxxxxx@gmail.com> wrote:
>>
>> Am So., 30. Juli 2023 um 00:11 Uhr schrieb John Cowan <xxxxxx@ccil.org>:
>
>
>>
>> Why should the Scheme system check the bound of V when asked for a
>> fast, unsafe version?  Accessing matrix elements could be compiled
>> into a simple memory fetch.
>
>
> Indeed, that is a valid implementation.  The sample implementation, however, does not do so.   Both safe and unsafe arrays are built on top of the same storage classes.

This is a detail of a particular implementation. As Bradley stated in
the initial post, a user may crash their system in the default setting
of SRFI 231.

>> > I would say per contra that all the libraries should expose the same API, but that asking for unsafety in the safe library (or vice versa) should have no effect, and therefore that `array-safe?` always returns true (or false).
>>
>> I disagree. Nothing forces us to define exactly the same imports for
>> each of the libraries, and it is better to get a warning about an
>> undefined identifier ("array-safe?") than exposing non-working
>> functionality where the user may think that "(array-safe? #t) does
>> make arrays safe but actually doesn't.
>
>
> Come to think of it, the mere fact that the safe library is imported does not mean that all arrays are safe, because a constructor can be imported from the unsafe library.

As soon as one unsafe library is imported into a system, the whole
system is not safe anymore. Think of a library that allows accessing
and modifying any memory address whatsoever.  Thus it is important to
have a version of SRFI 231 that is guaranteed to be safe (and whose
safety cannot be compromised by a switch and without importing an
unsafe library).