GNU bug report logs -
#77725
31.0.50; Add support for types accepted by `cl-typep' to cl-generic?
Previous Next
Full log
Message #260 received at 77725 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
On 2025-05-24 12:52, David Ponce wrote:
> Hello Stefan,
>
> Please find below the proposal for a new approach to speed up dispatch
> of methods with derived type specializers.
Hello Stefan,
Following our last exchange in French, to feed our discussion more
concretely, please find attached a new patch that explore further the
idea of removing the global variable `cl--derived-type-list', and make
`cl-types-of' a private function named `cl--derived-type-specializers'
with a mandatory argument to receive the list of dispatch types to
check.
The patch also improve a little the `cl-deftype' macro to allow
dispatching of atomic derived type with both optional
arguments and parents, like in this example:
(cl-deftype my-integer ()
'integer)
;; Currently the below declaration is not valid because ARGLIST and
;; PARENTS are both non-nil.
(cl-deftype unsigned-byte (&optional bits)
"Unsigned integer."
(declare (parents my-integer))
`(integer 0 ,(if (memq bits '(nil *)) bits (1- (ash 1 bits)))))
(cl-defmethod test-byte ((this my-integer))
(format "%S is an integer" this))
(cl-defmethod test-byte ((this unsigned-byte))
(format "%S is an unsigned byte - %s" this
(cl-call-next-method)))
David
[cl-types-V2.patch (text/x-patch, 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.