bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#50834: Feature request: cl-remove-method (prototyped) and buttons fo


From: Stefan Monnier
Subject: bug#50834: Feature request: cl-remove-method (prototyped) and buttons for it
Date: Fri, 02 Sep 2022 09:29:16 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

Lars Ingebrigtsen [2022-09-02 12:56:05] wrote:
> akater <nuclearspace@gmail.com> writes:
>> +(cl-defgeneric cl-remove-method (generic-function method)
>> +  "Remove METHOD from GENERIC-FUNCTION by modifying the
>> +GENERIC-FUNCTION (if necessary).
> I think this sounds very useful -- I don't think we have any other ways
> to remove a method, and that's something that I've been missing
> sometimes when implementing stuff.

I'd challenge your use of "very", but I agree it's missing.

> Perhaps Stefan has some comments here; added to the CCs.

Not much to say, except:

> +  (cl-loop for k being hash-key in cl--generic-combined-method-memoization
> +           when (and (eq generic-function (car k))
> +                     (memq method (cdr k)))
> +           do (remhash k cl--generic-combined-method-memoization))

I don't see why we'd need this.

This is a cache that tries to speed up the construction of combined
methods, whereas in `cl-remove-method` we should only need to flush the
cache that maps tags to their corresponding combined methods and this is
done implicitly by `cl--generic-make-function` (which returns a new
function with a branch new fresh cache).


        Stefan






reply via email to

[Prev in Thread] Current Thread [Next in Thread]