unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: "Pierre L. Nageoire" <devel@pollock-nageoire.net>
To: Stefan Monnier via Users list for the GNU Emacs text editor
	<help-gnu-emacs@gnu.org>
Cc: Stefan Monnier <monnier@iro.umontreal.ca>
Subject: Re: cl-defmethod specializer widget ?
Date: Fri, 28 Jan 2022 07:35:41 +0100	[thread overview]
Message-ID: <86k0ek5pvm.fsf@pollock-nageoire.net> (raw)
In-Reply-To: <jwv1r0tya1q.fsf-monnier+emacs@gnu.org> (Stefan Monnier via Users list for the's message of "Thu, 27 Jan 2022 01:28:46 -0500")


thanks Stefan ! That is clear !

Pierre 
Stefan Monnier via Users list for the GNU Emacs text editor
<help-gnu-emacs@gnu.org> 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



      reply	other threads:[~2022-01-28  6:35 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-26 14:09 cl-defmethod specializer widget ? Pierre L. Nageoire
2022-01-27  6:28 ` Stefan Monnier via Users list for the GNU Emacs text editor
2022-01-28  6:35   ` Pierre L. Nageoire [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=86k0ek5pvm.fsf@pollock-nageoire.net \
    --to=devel@pollock-nageoire.net \
    --cc=help-gnu-emacs@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).