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

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

bug#47327: 28.0.50; (cl-generic) eql specializer not evaluated


From: akater
Subject: bug#47327: 28.0.50; (cl-generic) eql specializer not evaluated
Date: Tue, 20 Jul 2021 02:28:12 +0000

Stefan Monnier <monnier@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.

Attachment: signature.asc
Description: PGP signature

Attachment: 0001-Upcoming-changes-to-eql-specializer-use.patch
Description: Necessary changes in eql specializer use


reply via email to

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