|
From: | Juri Linkov |
Subject: | Re: [PATCH] `affixation-function`: Allow only three-element lists |
Date: | Sun, 25 Apr 2021 23:34:23 +0300 |
User-agent: | Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu) |
>>> + (cl-assert (or (not completions) >>> + (= 3 (length (car completions)))))) > I am looking at the `affixation-function` from the perspective of how the > definition can be made as simple/predicatable as possible for the API user > since there are other completion UIs and many completion tables which will > make use of this. I treat the completion UI behind the API as a blackbox. I completely agree that for `affixation-function` part of the API is would be cleaner to document the input data as only candidate + prefix + suffix. But I don't agree with `cl-assert`. It looks too odd. Why to validate that the length of the first candidate is 3? Why not to validate than the length of every candidate is not more than 3? Why not to validate that there are no nils in the list? Why not to validate there are only strings? Etc. IOW, I think it's responsibility of the API user to provide valid data as documented.
[Prev in Thread] | Current Thread | [Next in Thread] |