I have come to regret the choice that initially, to hypothetically speed
array operations, the parameter specialized-array-default-safe? is not
#t, which would guarantee run-time checks of array getter and setter
arguments. It's not a good look when by default, a library crashes the
Scheme system when the programmer makes a mistake.
The SRFI document implies, but does not explicitly say, those checks are
not in place when an array is created and
specialized-array-default-safe? is #f.
I'm going to do some performance tests with Gambit's implementation of
SRFI 231, which tracks the sample implementation. If the performance
hit is not large, I may set Gambit's implementation to start with safe
arrays by default.
In a Gambit PR Marc Feeley commented "I would have created 2 variants of
the SRFI: (srfi 231) and (srfi 231 unsafe) so that ... by default you
get the type checks ..."
An interesting idea that would imply a compile-time choice of safe or
unsafe arrays instead of a runtime choice at array-creation time.
Brad
- Safe versus unsafe arrays Bradley Lucier
-