clasp icon indicating copy to clipboard operation
clasp copied to clipboard

(SETF AREF) does no type checking

Open Bike opened this issue 6 years ago • 1 comments

(let ((a (make-string 1 :element-type 'base-char)))
  (setf (aref a 0) #\u421)
  a)

gives "!"

I can (and will, I guess) write a compiler macro to handle it in inline.lisp, but the underlying function will need something too, unless we want to redefine it in lisp.

Edit: Or just define a setf expansion instead of having a function.

Bike avatar Apr 25 '19 20:04 Bike

This is basically due to various from_object methods not doing enough checks. Sometimes integer ranges are done as asserts and stuff...

Bike avatar Nov 25 '19 14:11 Bike