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

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

Re: Generic functions: Specializers like `or' or `memq'?


From: Stefan Monnier
Subject: Re: Generic functions: Specializers like `or' or `memq'?
Date: Sun, 21 Nov 2021 14:43:58 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

Michael Heerdegen [2021-11-07 02:48:04] wrote:
> Stefan Monnier via Users list for the GNU Emacs text editor
> <help-gnu-emacs@gnu.org> writes:
>
>>     (or (eql 4) integer)
>> and
>>     (or (eql 4) (eql 5))
>> and
>>     (or (eql 4) (eql "hello"))
>
> That's not a good example for how specializers I wanted to be able to
> write would look like, but I see the problem.

BTW, the above problem doesn't prevent defining an `or` specializer.
It just means that this specializer may not always behave quite like one
might expect :-(

I think a `memql` specializer would be easier and less likely to cause
problems: you could just give it a priority just below that of `eql`
(it may still get it wrong in that (memql true false maybe) would likely
get higher priority than a specializer like `boolean` which (if we were
to add such a type) would like only match `nil` and `t` and hence
should ideally have higher priorty instead).

Feel free to give us some concrete examples of the kinds of things you'd
like to do, if you want to see what it would take to support them.


        Stefan




reply via email to

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