(setf fdefinition) and (setf symbol-function) are type-unsafe
Bug #659173 reported by
Nikodemus Siivola
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
SBCL |
Triaged
|
Medium
|
Unassigned |
Bug Description
CL-USER> (declaim (ftype (function (t) (values string)) quux))
; No value
CL-USER> (setf (symbol-function 'quux) (lambda (x) (list x)))
#<FUNCTION (LAMBDA (X)) {1002D1F2F9}>
CL-USER> (defun foo () (length (quux 128)))
FOO
CL-USER> (foo)
128
Changed in sbcl: | |
status: | In Progress → Triaged |
To post a comment you must log in.
CLHS for System Class FUNCTION says "Thus, an ftype declaration for a function describes calls to the function, not the actual definition of the function."
Earlier in the same page, it says "The list form of the function type-specifier can be used only for declaration and not for discrimination."
On the whole, the MOST that I would expect here is an error that (128) is not of type STRING, signaled from FOO, and that's more a matter of not intrinsically believing FTYPE declarations than (SETF FDEFINITION) or (SETF SYMBOL-FUNCTION) not being typesafe.