clasp
clasp copied to clipboard
CL:FUNCTION ignores fboundedness
(let () #'asymbolthatdoesnotyetexist) => #<FUNCTION NIL>
I assume this is due to the change where calls don't check fboundness, and instead symbols that aren't fbound have a function that signals an unbound-function error. But fdefinition still signals an error.
Based on my reading of the CLHS this is not actually nonconforming. Still sucks though.
Plan for fixing this. First, background: In clasp functions are stored in symbols themselves. There is a slot for the symbol-function and one for #'(setf symbol). If there is no function, these are filled with a function that ignores its arguments and signals unbound-function, so that when we're looking up a function to call we don't need to branch. It's just that with cl:function we actually do need to branch.
Now: rewrite cleavir cst-to-ast a little so that the "look up a function that's about to be called" code is more distinct from the other function lookup code. Then add two new C++ functions probably, which look up the function or setf function and do error if the function is unbound. Then specialize our cleavir methods to use these for cl:function but not for the about-to-be-called lookups.