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

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

bug#66863: [PATCH] Add two docstrings in cl-macs.el


From: Stefan Monnier
Subject: bug#66863: [PATCH] Add two docstrings in cl-macs.el
Date: Tue, 31 Oct 2023 18:58:26 -0400
User-agent: Gnus/5.13 (Gnus v5.13)

> * lisp/emacs-lisp/cl-macs.el (cl--simple-exprs-p)
> (cl--const-expr-p): Add docstrings.

Hmm... tackling some tricky ones, eh?

>  (defun cl--simple-exprs-p (xs)
> +  "Check if no side effects, and executes quickly, for each element of list 
> XS."
>    (while (and xs (cl--simple-expr-p (car xs)))
>      (setq xs (cdr xs)))
>    (not xs))

I think I'd use a ref to `cl--simple-expr-p`, so we don't duplicate the
poorly defined "no side effects, and executes quickly".

Wait... `grep` says this function is not used any more, so maybe the
better option is to delete it.

> @@ -118,6 +119,7 @@ cl--safe-expr-p
>  
>  ;;; Check if constant (i.e., no side effects or dependencies).
>  (defun cl--const-expr-p (x)
> +  "Check if X is constant (i.e., no side effects or dependencies)."
>    (cond ((consp x)
>        (or (eq (car x) 'quote)
>            (and (memq (car x) '(function cl-function))

Yeah..hmm.. by order of increasing preference:
- Move the comment to the docstring rather that just copying it.
- Clarify the difference with `macroexp-const-p`.
- Declare the function obsoleted by `macroexp-const-p`.
- Delete the function altogether.


        Stefan






reply via email to

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