From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: "Pierre L. Nageoire" Newsgroups: gmane.emacs.help Subject: Re: cl-defmethod specializer widget ? Date: Fri, 28 Jan 2022 07:35:41 +0100 Message-ID: <86k0ek5pvm.fsf@pollock-nageoire.net> References: <86v8y6d1x0.fsf@pollock-nageoire.net> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="32189"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) Cc: Stefan Monnier To: Stefan Monnier via Users list for the GNU Emacs text editor Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Fri Jan 28 08:35:14 2022 Return-path: Envelope-to: geh-help-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 1nDLms-0008Ad-4K for geh-help-gnu-emacs@m.gmane-mx.org; Fri, 28 Jan 2022 08:35:14 +0100 Original-Received: from localhost ([::1]:51632 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nDLmq-0002A2-OG for geh-help-gnu-emacs@m.gmane-mx.org; Fri, 28 Jan 2022 02:35:12 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:40556) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nDLg7-00028h-Ot for help-gnu-emacs@gnu.org; Fri, 28 Jan 2022 02:28:22 -0500 Original-Received: from smtp09.smtpout.orange.fr ([80.12.242.131]:50874 helo=smtp.smtpout.orange.fr) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nDLg4-0006c9-5Q for help-gnu-emacs@gnu.org; Fri, 28 Jan 2022 02:28:14 -0500 Original-Received: from jabberwocky ([86.247.162.82]) by smtp.orange.fr with ESMTP id DLg1nRyzatSo5DLg1nxiW9; Fri, 28 Jan 2022 08:28:10 +0100 X-ME-Helo: jabberwocky X-ME-Date: Fri, 28 Jan 2022 08:28:10 +0100 X-ME-IP: 86.247.162.82 In-Reply-To: (Stefan Monnier via Users list for the's message of "Thu, 27 Jan 2022 01:28:46 -0500") Received-SPF: none client-ip=80.12.242.131; envelope-from=devel@pollock-nageoire.net; helo=smtp.smtpout.orange.fr X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:135584 Archived-At: thanks Stefan ! That is clear ! Pierre Stefan Monnier via Users list for the GNU Emacs text editor writes: >> I wonder why it is not possible to use widget as specializer in cl-defmethod. > > Because the current code only works for types that can be inferred > solely from the value of (type-of OBJ), basically. > > You can add support for `widget` as a specializer in two ways: > - Redefine widgets to use their own *real* type (i.e. with > `cl-defstruct`) instead of (ab)using symbols and cons cells. > - Add a method to `cl-generic-generalizers` to handle `widget` in an > ad-hoc way. > >> Indeed it is not declared in the suitable list but could >> it be added without trouble ; > > It would slow down dispatch, but only of those generic functions that > contain methods specializing on `widget`. > >> Similarly function is not accepted but it could be comfortable . > > Indeed, for the same reason: a value of the form (closure ...) or > (lambda ...) is a valid function, currently, but `type-of` returns > `cons` and not all `cons` are functions, so it would require > an additional method in `cl-generic-generalizers`. > > > Stefan