GNU bug report logs - #47327
28.0.50; (cl-generic) eql specializer not evaluated

Previous Next

Package: emacs;

Reported by: akater <nuclearspace <at> gmail.com>

Date: Mon, 22 Mar 2021 17:20:02 UTC

Severity: normal

Tags: fixed

Found in version 28.0.50

Fixed in version 28.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


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

From: akater <nuclearspace <at> gmail.com>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 47327 <at> debbugs.gnu.org
Subject: Re: bug#47327: 28.0.50; (cl-generic) eql specializer not evaluated
Date: Tue, 20 Jul 2021 02:28:12 +0000
[Message part 1 (text/plain, inline)]
Stefan Monnier <monnier <at> iro.umontreal.ca> writes:

> Could you check to see which code would break if we made this change?

I looked for “(eql” and then for “cl-defmethod”, searching for generated
code specifically.

Unless there's less obvious code that generates cl-defmethod forms, it
should all be in the attached patch.

>  (cl-defmethod cl-generic-generalizers ((specializer (head eql)))
>    "Support for (eql VAL) specializers.
>  These match if the argument is `eql' to VAL."
> -  (puthash (cadr specializer) specializer cl--generic-eql-used)
> +  (let ((form (cadr specializer)))
> +    (puthash (if (or (not (symbolp form)) (macroexp-const-p form))
> +                 (eval form t)
> +               (message "Quoting obsolete `eql' form: %S" specializer)
> +               form)
> +             specializer cl--generic-eql-used))
>    (list cl--generic-eql-generalizer))

Which implies, those who want to specialize on a value of symbol x
should write (eql (symbol-value 'x)), right?

This irregularity better be pointed out somewhere; I rarely read Elisp
manual so I'm not sure if it would be appropriate there.  Otherwise,
looks good, provided that it works.  (JFYI, I don't think I will be able
to properly test this patch soon enough.)

Please note that there are two spots in the patch where I'm not sure
what (if anything) should be done;  marked with WARNING.

[signature.asc (application/pgp-signature, inline)]
[0001-Upcoming-changes-to-eql-specializer-use.patch (text/x-diff, attachment)]

This bug report was last modified 3 years and 277 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.