Re: array-copy, array-stack, array-append: What should the defaults be?
Bradley Lucier 04 Oct 2021 22:04 UTC
On 10/4/21 5:34 PM, Alex Shinn wrote:
> Sorry, that was not worded clearly. By "built into the constructor" I was
> suggesting signatures of:
>
> make-specialized-array interval [ storage-class generic-storage-class
> ] [ safe? #f ]
> array-copy array [ storage-class generic-storage-class ] [ mutable? #t
> ] [ safe? #f ]
>
> where the defaults are specified by the standard and can't be changed.
> Note it's easier to remember if the defaults are all #f, so we could change
> mutable? to immutable?:
>
> array-copy array [ storage-class generic-storage-class ] [ immutable?
> #f ] [ safe? #f ]
>
> or split into separate procedures:
>
> array-copy array [ storage-class generic-storage-class ] [ safe? #f ]
> array-immutable-copy array [ storage-class generic-storage-class ] [ safe? #f ]
>
> It's especially mutability which needs to be prescribed by the SRFI or
> you lose portability.
>
> The safety setting shouldn't have any effect on a correct program,
> so that makes more sense to keep as a parameter. I don't have a
> preference there. I was just noting that if you want to make it an
> object that acts like a parameter it's best to explicitly make it a
> parameter.
OK, thanks, I'll think about it.
As an aside, is there a difference between SRFI 39 parameters and R7RS
parameters.
Brad