emacs-devel
[Top][All Lists]
Advanced

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

Re: What's missing in ELisp that makes people want to use cl-lib?


From: João Távora
Subject: Re: What's missing in ELisp that makes people want to use cl-lib?
Date: Thu, 16 Nov 2023 16:03:00 +0000

On Thu, Nov 16, 2023 at 3:43 PM Dmitry Gutov <dgutov@yandex.ru> wrote:
>
> On 16/11/2023 16:36, Augusto Stoffel wrote:
> >> That breaks any sequence type based on lists.  This is exactly the
> >> problem I was raising with too-many-generic interfaces, btw.
> > Good point.  IMO you just can't have both lists and "types based on
> > lists" to work together properly; if we defined a method for
> > seq-difference on lists, the issue would be the same (I guess that's the
> > caveat you raised regarding Dmitri's patch).
>
> Actually, we might not allow custom sequences based on lists to begin
> with. E.g. if there are two definitions
>
>   (cl-defmethod seq-length ((l (head :m6-sparse)))
>
> and
>
>   (cl-defmethod seq-length ((l list))
>
> ...is there a well-defined ordering between them which would determine
> the one that will be used for (cons :m6-sparse nil)?

The former is more specific and kicks in first.  So it's an implicit
interface already even if it not described anywhere (but it probably
is, I didn't check).

And then there's the :around, :before, etc methods.  Those are perfectly
well defined.

> If not, the optimization proposed by Augusto should be quite valid. And
> whatever custom sequences are added later, should use cl-defstruct or
> similar.

Looking forward to see benchmarks (and maybe some unit tests) based
on the latest branch.  If you can, please use my joaot/bench macro
it makes all this data easier to digest.

João



reply via email to

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