jscl
jscl copied to clipboard
Support (SETF name) as function names
Currently we have a hack to support (defun (setf name) ...)
, but (setf X)
doesn't work as proper functions. They can't be used with fdefinition
or function
.
Suggestions / Ideas
We should support a register of SETF functions. This can be implemented as a hash table or maybe just adding a setfFunc field to symbols.
This probably requires a few adjustments to the compiler anyway, so it could be worthy to have the support right in the compiler so it's available from the beginning?
The easiest way to implement such a setf-name registry
is to put a special system tag
with a bit mask
on the name (unification of system types - see https://github.com/jscl-project/jscl/issues/391#issuecomment-1036555699)
Using a hash-table
is trickier. It is impossible to raise the standard hash-table
to the boot level
. It is possible to implement a system hash-table
on pure js
(prelude.js) and api at the compiler level.
It is not yet clear here whether such objects should be tagged. Probably yes.
I would suggest the first option
for starters.