GNU bug report logs - #77725
31.0.50; Add support for types accepted by `cl-typep' to cl-generic?

Previous Next

Package: emacs;

Reported by: David Ponce <da_vid <at> orange.fr>

Date: Fri, 11 Apr 2025 07:16:01 UTC

Severity: normal

Found in version 31.0.50

Full log


View this message in rfc822 format

From: David Ponce <da_vid <at> orange.fr>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 77725 <at> debbugs.gnu.org, Eli Zaretskii <eliz <at> gnu.org>
Subject: bug#77725: 31.0.50; Add support for types accepted by `cl-typep' to cl-generic?
Date: Thu, 1 May 2025 17:51:49 +0200
[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.