fset
fset copied to clipboard
Tuple key infelicities
I went to use tuples for something, since I wanted the per-key default functionality which maps don't have, and immediately tripped over my own ill-considered design. Specifically:
- Instead of a default value,
define-tuple-keytakes a function to compute the default value, given the existing tuple. I'm sure I thought this was clever when I did it, but it doesn't now seem to me to be something I'll ever use. Instead, I now believe it should take a default value so it can warn (maybe even signal a continuable error) when you change it. - Speaking of which, there's currently no public interface to change the
default-fnof an existing key;define-tuple-keydoesn't do it. - For reasons that escape me, a doc string supplied to
define-tuple-keyis attached to the symbol via itsfset::tuple-key-doc-stringproperty, rather than being passed todeflex(which would use(setf documentation), which would be much more likely to make the string displayable by Slime etc.). Worse, the property is set at expansion time, not load time.
Changing the default from a function to a value would be a breaking change, so I'm hesitating. Maybe this should be done in fset2: only. OTOH, it's entirely plausible that no one has ever used tuples; the use case is a bit niche, and the documentation isn't really very encouraging.