make-specialized-array argument order Bradley Lucier (24 May 2022 20:40 UTC)
Re: make-specialized-array argument order Bradley Lucier (25 May 2022 15:34 UTC)
Re: make-specialized-array argument order Alex Shinn (26 May 2022 23:41 UTC)
Re: make-specialized-array argument order Lucier, Bradley J (27 May 2022 00:09 UTC)
Re: make-specialized-array argument order Lucier, Bradley J (27 May 2022 00:48 UTC)
Re: make-specialized-array argument order Bradley Lucier (26 May 2022 14:13 UTC)

make-specialized-array argument order Bradley Lucier 24 May 2022 20:39 UTC

Before the recent large update, the calling sequence for
make-specialized-array was

make-specialized-array interval [storage-class [initial-value [mutable?
[safe?]]]

After the large update, the calling sequence is

make-specialized-array interval [initial-value [storage-class [mutable?
[safe?]]]

which makes it possible to specify an initial-value without specifying a
storage-class.  (And since the default storage-class is
generic-storage-class, which accepts any initial value, it makes error
checking a bit easier.)

So:

Before: If you want to specify an initial value, you must first specify
a storage class, which is eventually mind-numbing.

After: If you want to specify a storage-class, you must first specify an
initial value, which makes (storage-class-default storage-class) almost
useless.

Which brought to mind whether keyword arguments would be best for
specifying the argument list for make-specialized-array:

(define (make-specialized-array
          interval
          #!key
          (storage-class (generic-storage-class))
          (initial-value (storage-class-default storage-class))
          (mutable?      (specialized-array-default-mutable?))
          (safe?         (specialized-array-default-safe?)))
   ...)

Are keyword arguments widely enough supported for this to be a good
thing to do?

If not, which argument order would be better?

Brad