GNU bug report logs -
#77725
31.0.50; Add support for types accepted by `cl-typep' to cl-generic?
Previous Next
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
On 2025-04-30 11:28, David Ponce wrote:
> On 2025-04-29 20:02, Stefan Monnier wrote:
>> Further comments:
>>
>> - For a declaration like
>>
>> (cl-deftype list-of (elem-type)
>> `(and list
>> (satisfies ,(lambda (list)
>> (cl-every (lambda (elem) (cl-typep elem elem-type))
>> list)))))
>> we add the type to `cl--type-list` even though it's unusable there
>> (the `cl-typep` call in `cl-types-of` will always signal an error
>> because the type can't be used without argument).
>>
>> - One way to solve the problem with `list-of` (and even open up the
>> possibility to dispatch on complex types like `(list-of FOO)`) is to
>> populate `cl--type-dispatch-list` (i.e. the list of types that need to
>> be checked during dispatch) from `cl-generic-generalizers` so it
>> includes only those types for which there's a method, rather than all
>> defined types.
>>
Please find attached a version of cl-types.el with my first try at
implementing something related to your idea above to populate a
`cl--type-dispatch-list' from `cl-generic-generalizers'.
Changes are at the end of the file in the last section "Method dispatching".
I hope I started understanding your idea ;-)
Thanks!
David
[cl-types.el (text/x-emacs-lisp, attachment)]
This bug report was last modified 10 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.