From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: akater Newsgroups: gmane.emacs.bugs Subject: bug#47327: 28.0.50; (cl-generic) eql specializer not evaluated Date: Mon, 22 Mar 2021 17:08:09 +0000 Message-ID: <87k0pz5d6u.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="9420"; mail-complaints-to="usenet@ciao.gmane.io" To: 47327@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Mar 22 18:30:35 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lOONu-0002Kw-Nt for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 22 Mar 2021 18:30:34 +0100 Original-Received: from localhost ([::1]:37448 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lOONt-000555-OG for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 22 Mar 2021 13:30:33 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:40880) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lOODm-0000xx-Q5 for bug-gnu-emacs@gnu.org; Mon, 22 Mar 2021 13:20:07 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:46907) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lOODi-0001Wy-Bg for bug-gnu-emacs@gnu.org; Mon, 22 Mar 2021 13:20:06 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lOODi-0008L0-6D for bug-gnu-emacs@gnu.org; Mon, 22 Mar 2021 13:20:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: akater Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 22 Mar 2021 17:20:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 47327 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.161643356432000 (code B ref -1); Mon, 22 Mar 2021 17:20:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 22 Mar 2021 17:19:24 +0000 Original-Received: from localhost ([127.0.0.1]:58453 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lOOD5-0008K3-KA for submit@debbugs.gnu.org; Mon, 22 Mar 2021 13:19:23 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:36310) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lOOD4-0008Jv-85 for submit@debbugs.gnu.org; Mon, 22 Mar 2021 13:19:22 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:40664) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lOOD2-0000WQ-H8 for bug-gnu-emacs@gnu.org; Mon, 22 Mar 2021 13:19:21 -0400 Original-Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]:43560) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lOOCz-0001EQ-8D for bug-gnu-emacs@gnu.org; Mon, 22 Mar 2021 13:19:19 -0400 Original-Received: by mail-wm1-x334.google.com with SMTP id u5-20020a7bcb050000b029010e9316b9d5so9409529wmj.2 for ; Mon, 22 Mar 2021 10:19:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:mime-version; bh=QX9O9d806G+bEwZbLA1VJKBVggN0R4xHpqXK7r6h5VE=; b=JccaBoRa4ELoqPxZXl4oSlrT7ODb8klzJc1jUzt76rdVqqTU6TOU14mZ1tmfXzJS8O Yjy/JljJbmK7EpSxXvOlgWmGeBk+N40yEkrlX8Z4AzQZoQBvm7n3JHbRaovE6NjC3crT 2P6FFLf3KFyiicxfmuAUfnzNC79Q/zyKzbjoBY+8idczSZgB7/yL5Dso8Gk5IT3PMT0G ZdVTlii72X5TH+aZzd94rTh4aXnjgxJZlgg3Fs5UQQY6jGtOlrXbqehrVXz1JxHlCfpV BUabn5uVa4fw2PnFmTVFQ94+msEnT76HCBBPOOooCXb+8ofrlySZy4ewdRfd9kANh7wY NxSA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version; bh=QX9O9d806G+bEwZbLA1VJKBVggN0R4xHpqXK7r6h5VE=; b=EBoB7K6dZskshEuzUwnNywOHHtmLDXbgrfIFgmAp/kOAEkpFTvWBv59EyYdnZnJ8jl 2cbPG/H3NpsXQH6RuwoNI+BtaPwkyEOCjD/HjKR0JLqbPFOKLWvbVdw5qS2OIQUBV5sk 0M90RG/8L2zS+3mLihhvTfXOrsbGwe1bWkXrkxRgF9s86yTSSOi+uemot5an+kRP7Ay/ um9km3p+bra/8YOvarJL/FlR8uUZwla4TaooYpNMisxM56Eic1OOfUd5TLbCNwQmRPhl AOsJfpa/sWl/WouZcDINWjuRyR4xo6zuaeNdCRx1ddIWQSnivdJy1WZ1kw2zXloF3yQv FXxg== X-Gm-Message-State: AOAM5309mRzI+G3Xs5A9A611zo98TsrcWHa6QXHPqGab6kV/8v8j/7tL W5zql6Fw/6IS+fDWRgOpVF5yITyXeQyinQ== X-Google-Smtp-Source: ABdhPJwvYMHUUOf5flFbfLyvDkdFCYgTa9vPT9dyBcY/QihAuJ7BLyxAnuhzGi12ZgfJCgnz2EBw6g== X-Received: by 2002:a05:600c:22cd:: with SMTP id 13mr105847wmg.90.1616433554888; Mon, 22 Mar 2021 10:19:14 -0700 (PDT) Original-Received: from localhost (tor-exit-relay-7.anonymizing-proxy.digitalcourage.de. [185.220.102.253]) by smtp.googlemail.com with ESMTPSA id g16sm21702738wrs.76.2021.03.22.10.19.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Mar 2021 10:19:14 -0700 (PDT) Received-SPF: pass client-ip=2a00:1450:4864:20::334; envelope-from=nuclearspace@gmail.com; helo=mail-wm1-x334.google.com X-Spam_score_int: -7 X-Spam_score: -0.8 X-Spam_bar: / X-Spam_report: (-0.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_BL_SPAMCOP_NET=1.347, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:202845 Archived-At: --=-=-= Content-Type: text/plain In ~(eql VAL)~ specializer, ~VAL~ should evaluate during evaluation of the macroexpanded ~cl-defmethod~ form. For some reason =cl-generic.el= does not do that (it does not evaluate the specializer form at all). Here's a hack fix that seems to work for me but I do not have a deep enough understanding of ~cl-generic~ to actually suggest it: #+begin_src emacs-lisp :results none (cl-defmethod cl-generic-generalizers ((specializer (head cl:eql))) "Support for (eql VAL) specializers. These match if the argument is `eql' to VAL." (let ((value (eval (cadr specializer) t))) (setf (car specializer) 'eql) (puthash value specializer cl--generic-eql-used)) (list cl--generic-eql-generalizer)) #+end_src Rationale: (1) See Common Lisp HyperSpec: #+begin_quote The parameter specializer name ~(eql eql-specializer-form)~ indicates that the corresponding argument must be eql to the object that is the value of ~eql-specializer-form~ for the method to be applicable. The ~eql-specializer-form~ is evaluated at the time that the expansion of the defmethod macro is evaluated. #+end_quote --- [[http://www.lispworks.com/documentation/HyperSpec/Body/m_defmet.htm][Macro DEFMETHOD]] (2) With eql specializer form not evaluated it does not seem possible to e.g. use a custom method combination, even though ~cl-generic~ informs that it is possible. The only way I can think of, is specializing ~cl-generic-combine-methods~ on the particular generic function: #+begin_src emacs-lisp :results none :eval never (cl-defmethod cl-generic-combine-methods ((generic (cl:eql (cl--generic 'my-generic-function))) methods) "Use `my-method-combination' method for generic function `my-generic-function'." (my-method-combination generic methods)) #+end_src which is impossible if the specializer form is not evaluated. (3) With eql specializer form not evaluated, it is only possible to dispatch on eql numbers or eql symbols which is needlessly limited. --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQJLBAEBCgA1FiEEgu5SJRdnQOF34djNsr6xYbHsf0QFAmBYzvkXHG51Y2xlYXJz cGFjZUBnbWFpbC5jb20ACgkQsr6xYbHsf0SYBhAAu+NeuL2Asu7Sz2QFjlZ/ap0z I3jC8XfWH0u6tl3iur0q+5p8lBXHFShCllCGHphUdA2BW7/Ge0vNYhPbkWVGcSY6 KxV5G/kPsj7HyXoIrBplN9kBrUlLKnRty/0ffGvr7LCI3YstuLDoZNyVQw+g20uO hfqNGA/WzZCwBfVrUYZncq0owLZKfk6hiN3o0lKOyoU+jLNWem8xSZ0UezrNa1Ta /zCl2tLac/lJWRFgfwHm0Q5r01HzVu1vLsOkj/kose05aqs6AHn2f5ekM2RpT6lY cdsC6c/m1CjZ6o2RjIJw8RjPqfx4v1ZSeqZr21KAhIP/z2K2nUYfO90vFdXFh05C eIS1YR2rnMV2A/yxtBbIS+lo5W1PdkO7C18bhm2LF1xiy9e6mv9BJdatT8pY2F3B wLwDrHMja1KdUI0lO1Q+wKFpQR+ugo6El+tXRzzGNd9gF/xlZvp5/kjc8aqB0XRU zhsRHPQjRjpnjZBALyTphGP1ppxvyvU/j83FR1b7Hcy73hX/+sNf6S2Cc3ryplIZ 3aAFhKwalLwlR26W0anuWUpDqa0PkJNfugIL8KtXMZMjS+Uf4CRh/rlejrRF2fUj RmXc+LMvDRewKqjoCKmqXJtcLNxG+wU7TqEAQz879LZzqMgUYDBJfFmqYfnpFLG1 ESUtpGXWY0SEqpV+lDs= =WUyp -----END PGP SIGNATURE----- --=-=-=--