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

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

Re: cl-defmethod specializer widget ?


From: Pierre L. Nageoire
Subject: Re: cl-defmethod specializer widget ?
Date: Fri, 28 Jan 2022 07:35:41 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

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 via email to

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