[racket-dev] Fixing "uncertified context" error in in-vector

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Sun Dec 5 11:31:35 EST 2010

At Sun, 5 Dec 2010 15:33:06 +0000, Noel Welsh wrote:
> On Sun, Dec 5, 2010 at 1:38 PM, Matthew Flatt <mflatt at cs.utah.edu> wrote:
> > Also, you're using `unsafe-fx...' on numbers that haven't been checked
> > to be fixnums (i.e., `exact-nonnegative-integer?' does not imply
> > fixnum). I think you should just use generic arithmetic.
> You can't allocate more than a fixnum number of bytes, I believe. So
> start and stop must be fixnums if they're to be valid.

Yes, but the `unsafe-fx' operations that I'm concerned about are the ones
checking whether an index is valid:

  (unless (and (exact-nonnegative-integer? start) (unsafe-fx< start len))
    (raise-type-error who (format "exact non-negative integer in [0,~a)" len) start))
  (unless (and (integer? stop) (unsafe-fx<= -1 stop) (unsafe-fx<= stop len))
    (raise-type-error who (format "exact integer in [-1,~a] or #f" len) stop))

Posted on the dev mailing list.