clasp icon indicating copy to clipboard operation
clasp copied to clipboard

CL:FUNCTION ignores fboundedness

Open Bike opened this issue 7 years ago • 2 comments

(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.

Bike avatar Jul 23 '18 19:07 Bike

Based on my reading of the CLHS this is not actually nonconforming. Still sucks though.

Bike avatar Apr 21 '20 18:04 Bike

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.

Bike avatar Sep 21 '20 17:09 Bike