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


Message #260 received at 77725 <at> debbugs.gnu.org (full text, mbox):

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: Re: bug#77725: 31.0.50; Add support for types accepted by `cl-typep'
 to cl-generic?
Date: Thu, 5 Jun 2025 11:14:59 +0200
[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.