fset icon indicating copy to clipboard operation
fset copied to clipboard

Tuple key infelicities

Open slburson opened this issue 1 year ago • 0 comments

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-key takes 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-fn of an existing key; define-tuple-key doesn't do it.
  • For reasons that escape me, a doc string supplied to define-tuple-key is attached to the symbol via its fset::tuple-key-doc-string property, rather than being passed to deflex (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.

slburson avatar Sep 18 '24 07:09 slburson