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: Stefan Monnier
Subject: Re: What's missing in ELisp that makes people want to use cl-lib?
Date: Thu, 16 Nov 2023 21:44:24 -0500
User-agent: Gnus/5.13 (Gnus v5.13)

> But cl-defmethod with just one method resulting in a simple function
>  definition in an experimental fact (evaluate (cl-defmethod abc () 345);
>  then (cl-defmethod abc () 345) returns (lambda nil (progn 345))), so that
> must be faster, without any computation of applicable methods.

"one method" is necessary but not sufficient for this optimization.
This one method has to have no specializer (aka only the `t` specializer).

> The comment above the code you quoted mentions "generic functions with
> a single method"; maybe it was written before the above optimization
> was made.

No, that comment refers to the case where there's a single method but
with a non-t specializer, so we can't just always call that one method
without first testing that the arg matches the specializer.


        Stefan




reply via email to

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