[racket-dev] Release for v5.0.2 has begun

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Sun Oct 24 10:53:34 EDT 2010

At Fri, 22 Oct 2010 21:31:43 -0600, Doug Williams wrote:
> Matthew, would it make more sense to have unsafe-vector-ref (and related
> functions) be the more general function and unsafe-vector*-ref be the one
> that doesn't work  on chaperoned vectors? That is just swap the definitions.
> That way user code that is already using unsafe-vector-ref (etc) will
> continue to work.
> 
> As it stands, existing code that has unsafe-vector-ref (etc) will often
> still work (in the sense of not getting any error or crashing), but just
> gives the wrong results. For example, if you run science-test.ss from the
> examples directory in the science collection, there are no errors. But, some
> of the answers are wrong - for example the very first one, the gamma
> function. [In other cases, like the FFT routines, there are either run-time
> errors or crashes.]
> 
> Anyway, if it isn't too late, I think swapping the definitions would make
> more sense and be safer.

I've gone back and forth. I agree that it would be safer, but
`vector-ref' is safer still, and I think of the job of `unsafe-X' as
providing the lowest possible overhead over `X'. It seems nicer to me
to have `*' mean "somewhere in between" rather than "even faster". Then
again, it seems bad that `vector?' (plus index bounds) isn't enough to
guard `unsafe-vector-ref'.

Overall, at this point in the release cycle, I'm inclined to leave
things where they are (i.e., it may be too late). But let's hear more
opinions from those who use `unsafe-vector-ref' and
unsafe-vector*-ref'.



Posted on the dev mailing list.